Round(numbers)

  • Thread starter Thread starter seemee2002
  • Start date Start date
S

seemee2002

I am using
Round(expression [,numdecimalplaces])

why it rounds even numbers like 22.5 to 22, but odd
number like 23.5 to 24. any idea please?
 
The Round() function uses Banker's Rounding which rounds the exact 0.5 to
"nearest even" which is what you got (2 & 4).

You can avoid this by introduce a very small bias value to force to Round()
function to go up or down deterministically. For example, if my input is
only 2 decimal places, then I can use bias = 0.001. In this case (from the
Debug window:

* If I want to round UP 0.5:
Bias = 0.001

?Round(12.5 + Bias)
13
?Round(13.5 + Bias)
14

* To wound DOWN 0.5:

?Round(12.5 - Bias)
12

?Round(13.5 - Bias)
13
 
Back
Top