If for rounding numbers

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Does anyone know a IIf statement which tells a decimal
number to round up to the nearest whole number? For
example if a number is 87.54 to simple round to 88 and if
it's 78.43 to round to 78?
 
If all the number are positive values, you can use

-Int(-YourNumber) to round up to the next highest integer.
 
thanks for the help - but my numbers range from 85.01 to
90.49 - is there a if statement for my query that lookd st
everything and says ... look at the intergers and round up
or down to the next whole number?
 
Hi Mike,

?Int(87.54 +.5)
88
?Int(78.43 +.5)
78

thanks for the help - but my numbers range from 85.01 to
90.49 - is there a if statement for my query that lookd st
everything and says ... look at the intergers and round up
or down to the next whole number?
 
Sorry, my mistake. I read your request as ROUND UP to the highest integer.

Try

CInt(YourNumber + .0000000001)

If you want Banker's rounding, then
CInt(YourNumber)
should do it. Banker's rounding rounds up or down to the nearest even number
when the last significant digit ends in 5.

So 78.5 --> 78, but 79.5 --> 80
 
Back
Top