Andrew,
There is no VBA 'Round' function (not w/ Excel 97 anyway).
You could use cLng instead:
When the fractional part is exactly 0.5, CInt and CLng
always round it to the nearest even number. For example,
0.5 rounds to 0, and 1.5 rounds to 2. CInt and CLng differ
from the Fix and Int functions, which truncate, rather
than round, the fractional part of a number. Also, Fix and
Int always return a value of the same type as is passed in.
This is still a bit querky on the 0.5 fraction. To always
round up from 0.5 try:
MyRound = int(MyConst + 0.5)
David
-----Original Message-----
If in a cell on a spreadsheet, I enter the following
equation:
=ROUND(50.5, 0)
I obtain the result 51, which I would expect, since 0.5
should be rounded
up.
If I write the following VB funcion:
Function RoundFunc(Mark As Integer) As Integer
RoundFunc = Round(Mark, 0)
End Function
And then enter the following equation into a cell:
=RoundFunc(50.5)
I obtain the result 50. i.e. 0.5 is rounded down
Why the difference? Is there a function that I can use
in my
VB code that
will round 0.5 up rather than down?
.