Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
pod pod is offline
external usenet poster
 
Posts: 3
Default Does VBA round .5 up or down?

Rounding in VBA doesn't seem to be consistent. Running the following code
shows that 3.825 rounds down to 3.82, and 3.875 rounds up to 3.88.

MsgBox ("3.825 rounded = " & Round(3.825, 2) & "; 3.875 rounded = " &
Round(3.875, 2))

Is there an explanation for this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Does VBA round .5 up or down?

VBA uses "Banker's Rounding" (which I think is a term that MS made up),
to round a 5 in the least significant digit to the nearest *even* number
in the next most significant digit.

This method is frequently used in science and statistics. See

http://support.microsoft.com/kb/196652/EN-US/

In article ,
pod wrote:

Rounding in VBA doesn't seem to be consistent. Running the following code
shows that 3.825 rounds down to 3.82, and 3.875 rounds up to 3.88.

MsgBox ("3.825 rounded = " & Round(3.825, 2) & "; 3.875 rounded = " &
Round(3.875, 2))

Is there an explanation for this?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Round Up and Round Down Time DaveMoore Excel Worksheet Functions 2 January 1st 10 12:00 PM
Round to .05 or .09 Bruce Excel Worksheet Functions 4 May 14th 09 07:56 AM
Round up rexmann Excel Discussion (Misc queries) 7 April 13th 06 01:48 PM
VBA round Jeff Excel Discussion (Misc queries) 8 September 2nd 05 02:38 AM
How do I ROUND() round off decimals of a column dataset? Højrup Excel Worksheet Functions 2 January 12th 05 10:50 AM


All times are GMT +1. The time now is 07:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"