Round Function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
(MS Access XP)

I'm having a problem, maybe I'm missing something.
(in a MS Access Query):
Sometimes Round(66.5) = 66 and Round(22.5) = 23.
I made a test from VBA:
Msgbox Round(x.5) = x + 1 always

This is very wierd.

Any Help will be very appreciated.
Thanks in advance.

GH
 
The Round() function performs what we refer to as Bankers rounding, i.e. it
rounds .5 towards the *even* number.

The logic is that you have a bias caused if you round 4 numbers downwards
(1,2,3,4) and 5 numbers upwards (5,6,7,8,9). To remove the bias, the 5 needs
to be rounded down half the time and up half the time. Rounding towards the
even number achieves that.

While it is probably best to work with this approach to rounding, Ken Getz
published a function that allows you to specify whether to use bankers
rounding or not. See:
http://www.mvps.org/access/modules/mdl0054.htm
You will need to rename this function if you use it in Access 2000 or later.
 
Back
Top