View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Joe User[_2_] Joe User[_2_] is offline
external usenet poster
 
Posts: 905
Default rounding to nearest .5 in vba

"Ron Rosenfeld" wrote:
I thought it was clear that I was referring to midpoint issues

[....]
"And you did not define what you wanted to do in the event
that your value fell exactly on the midpoint.

[....]
"The VBA Round function rounds to the nearest even number."


I concur: I took your latter statement out of context. Mea culpa!

But I still think it is important to emphasize the unlikely difference that
"banker's rounding" makes in general, IMHO.

I think we can let the horse into heaven now. :-)


----- original message -----

"Ron Rosenfeld" wrote in message
...
On Wed, 3 Mar 2010 13:56:09 -0800, "Joe User" <joeu2004 wrote:

The VBA Round function rounds to the nearest even number.


That is not quite correct. For example, Round(2.xx,0) is 2 only when 2.xx
is exactly 2.50. Round(2.51,0) is 3.


I guess putting the formula example after defining the context for that
statement and before making that statement made it unclear that that
statement
applied when the value fell exactly on the midpoint. I thought it was
clear
that I was referring to midpoint issues, but I guess I'll have to be more
careful.


"And you did not define what you wanted to do in the event that your value
fell
exactly on the midpoint.

"The general formula, would be Round(n/0.5,0)*0.5

"The VBA Round function rounds to the nearest even number."
--ron