Rounding Up

Talismanic

Registered User.
Local time
Today, 06:02
Joined
May 25, 2000
Messages
377
Round number up to nearest whole number?

I have a field in a query that I want to round up to the nearest whole number. How do I do this? Here is the field:

Numb: [MonTimesEmpPay]
 
if you want to round upwards only to the next highest integer, i.e. 1.9 becomes 2, but 1.1 also becomes 2, then:

Numb: Int([MonTimesEmpPay]+1)

will do it, except for the unfortunate side effect of rounding 1.0 to 2, so something like:

Numb: Iif([MonTimesEmpPay]=int([MonTimesEmpPay]),[MonTimesEmpPay],Int([MonTimesEmpPay]+1))

Which willonly attempt to round up non-integer values.

HTH

Mike
 
I have a similar problem and hopefully someone has a solution. I have a number to 2 decimal places, which is in percent. I need to round this number to the next highest tenth. For example:

91.10% = 91.1%
91.11% = 91.2%

I know this follows no logical mathematical standard, but that's what I need... Any ideas how to get this? I used the above formula, but it rounds to the nearest whole number. I've tried using 0.1 at the end, but it didn't help. Maybe dividing by? Multiplying by?

Help!
smile.gif
 
I would try Int([PercentField]*1000+0.9)/1000

Which basically takes your .9111, makes it 911.1+.9 or 912.0, and then drops it back down to .912.

Adding .9 instead of 1.0 means you can avoid the Iif() statement Mike Gurman suggested.

HTH,
David R
 
It worked great, David!

That's 2 I owe you for this week! Thanks for your all of your help!
 

Users who are viewing this thread

Back
Top Bottom