# Round Gives Unexpected Results

• ### Question

• I have some VBA code in Word using the Round() function, and it's giving strange results.

Round(15/6,0) returns 2

Round (3/2, 0) returns 2

(I want to round #.5 to #+1, and #.499999 to #, i.e. the way everyone is taught in grade-school).

This may be a floating-point precision issue? Is there a work-around?  Many thanks!

DragonForest

Monday, July 21, 2014 2:37 AM

• The Round function uses so-called banker's rounding: a number ending in .5 is rounded to the nearest even integer.

0.5 > 0
1.5 > 2
2.5 > 2
3.5 > 4
4.5 > 4

etc. To round a positive number x up to the nearest integer, you can use Int(x + 0.5)

Regards, Hans Vogelaar (http://www.eileenslounge.com)

• Marked as answer by Monday, July 21, 2014 2:31 PM
Monday, July 21, 2014 5:26 AM

### All replies

• The Round function uses so-called banker's rounding: a number ending in .5 is rounded to the nearest even integer.

0.5 > 0
1.5 > 2
2.5 > 2
3.5 > 4
4.5 > 4

etc. To round a positive number x up to the nearest integer, you can use Int(x + 0.5)

Regards, Hans Vogelaar (http://www.eileenslounge.com)

• Marked as answer by Monday, July 21, 2014 2:31 PM
Monday, July 21, 2014 5:26 AM
• Thank you!

DragonForest

Monday, July 21, 2014 2:31 PM