round up function

S

slymeat

Is there a standard a VB function that rounds up a long to it's nearest
integer (and always rounds up)?
 
O

OfficeDev18 via AccessMonster.com

Why not use the old standby, adding .5 to your original number, as in:

Round(SomeDecimalNumber + .5000, 4), which, if SomeDecimalNumber = 4.5000,
will result in 5. As I remember, it always rounds up.

Sam
 
J

John Spencer

Since a LONG number is an integer, I can only guess you want to round a
number of type double up to the next integer.

There is no built in function to round up to the nearest integer. You
should be able to use

-Int(YourNumber * -1)

Note this rounds to the next higher integer, so negative numbers will round
towards zero.
-3.1 will return -3 (not -4)
 
T

Tim Ferguson

There is no built in function to round up to the nearest integer. You
should be able to use
RoundUp = IIf(Int(AValue)=AValue, _
AValue,
Int(AValue)+1
)

.... as long as AValue is a valid Double or Single value.


Tim F
 
Top