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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top