ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Behaviour of VBA ROUND function (https://www.excelbanter.com/excel-programming/319763-behaviour-vba-round-function.html)

Microsoft Forum

Behaviour of VBA ROUND function
 
Hi all,

I have a question of dealing with VBA ROUND function, the question is that
it doesn't do the rounding consistently.

For example:

ROUND(100.5) - 100
ROUND(100.6) - 101
ROUND(100.55,1) - 100.6

Why is that? Is it a bug? Please advise.

Frederick Chow
Hong Kong.



Frank Kabel

Behaviour of VBA ROUND function
 
Hi
maybe:
http://www.xldynamic.com/source/xld.Rounding.html#vba

--
Regards
Frank Kabel
Frankfurt, Germany
"Microsoft Forum" schrieb im Newsbeitrag
...
Hi all,

I have a question of dealing with VBA ROUND function, the question is that
it doesn't do the rounding consistently.

For example:

ROUND(100.5) - 100
ROUND(100.6) - 101
ROUND(100.55,1) - 100.6

Why is that? Is it a bug? Please advise.

Frederick Chow
Hong Kong.




Tom Ogilvy

Behaviour of VBA ROUND function
 
How about rounding to the next even value. Wouldn't that be consistent?
? round(101.5)
102
? round(100.5)
100
? round(101.5)
102
? round(102.5)
102
? round(103.5)
104
? round(100.55,1)
100.6
? round(100.45,1)
100.4

Is it a bug?

No
http://support.microsoft.com/default...b;en-us;194983
PRB: Round Function different in VBA 6 and Excel Spreadsheet
--
Regards,
Tom Ogilvy



"Microsoft Forum" wrote in message
...
Hi all,

I have a question of dealing with VBA ROUND function, the question is that
it doesn't do the rounding consistently.

For example:

ROUND(100.5) - 100
ROUND(100.6) - 101
ROUND(100.55,1) - 100.6

Why is that? Is it a bug? Please advise.

Frederick Chow
Hong Kong.





Tom Ogilvy

Behaviour of VBA ROUND function
 
This might be of interest as well:


http://support.microsoft.com/default...b;en-us;196652
How To Implement Custom Rounding Procedures

--
Regards,
Tom Ogilvy


"Microsoft Forum" wrote in message
...
Hi all,

I have a question of dealing with VBA ROUND function, the question is that
it doesn't do the rounding consistently.

For example:

ROUND(100.5) - 100
ROUND(100.6) - 101
ROUND(100.55,1) - 100.6

Why is that? Is it a bug? Please advise.

Frederick Chow
Hong Kong.






All times are GMT +1. The time now is 05:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com