round up function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a standard a VB function that rounds up a long to it's nearest
integer (and always rounds up)?
 
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
 
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)
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Round number subject to it's value 1
Rounding 3
Rounding help 1
Rounding down to .00 .25 .50 .75 1
ALWAYS ROUND UP 3
News CES 2019 round up 6
Round up 10th of Decimal 1
in access, round up to nearest fraction(.5) 1

Back
Top