Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I would like to round UP to thousands, hundreds depending on value 1

Status
Not open for further replies.

Senjen

Programmer
Jul 14, 2000
23
US
In a query I would like to round up to nearest thousand if over 500, to nearest hundred if over 50 and leave any smaller values alone. Any thoughts?
 
Hi,
Code:
IIF([MyField]>500,INT(([MyField]+1000)/1000)*1000,IIF([MyField]>50,INT(([MyField]+100)/100)*100,[MyField]))


Skip,

[glasses] [red]Be advised:[/red] It's been reported that a wee psychic is roaming the countryside.
Small Medium @ Large! [tongue]
 
Skip your the best, just couldn't see it. Works perfectly.
 
Hey Skip,

In Excel, you can use:

Round([your number],-3)

To get to the nearest thousand. Does this not work that way in Access?


Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
askdon@srhconsulting.com
 
dg,

I suppose that it would, and it would be a simpler solution for sure. I just tend to think in terms of the basic math.

Skip,

[glasses] [red]Be advised:[/red] It's been reported that a wee psychic is roaming the countryside.
Small Medium @ Large! [tongue]
 
I tried the Round([your number],-3) and got an error before I posted. Looked good to me too. Could be the formatting of my data. Never really looked at it too hard.
 
I also got the error. I guess it cannot be used in Access.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
askdon@srhconsulting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top