Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding up to nearest whole number

Status
Not open for further replies.

knighty03

Technical User
Aug 12, 2003
32
GB
Does anyone know how to round up a number to the nearest whole number eg. if 2.1 it will round up to 3, it cannot round down which is what is happening to me.
 
Hi knighty,

The Int function will always round the number down, so just add 1 if you always want to round up, like this:

numvalue = Int(numvalue) + 1

Hope this helps.

Regards,
gkprogrammer
 
You should probably use an expression like this

= -1 * Int(-1 * [Number])

If your value is a whole number and you use Int(number) +1 then you round up a value that you should not be rounding (i.e. 2 becomes 3 when it should remain 2)


Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top