Round up number

B

blake7

Hi all, is it possible to round up numbers in a text box that contains a
calculation as per my example below, I have the text box format set to
standard and decimal places to 0, but if the calculation (depending on the
numbers entered) return say 0.8 i would like the box to dispaly 1 (rounded
up) rather than zero as it does now!
Thanks
Tony

=[text98]*[text99]/100
 
A

Al Campagna

Blake7,
There may be a more elegant solution but...
Try... (on one line)
=IIF(([text98]*([text99]/100) = Int([text98]*[text99]/100),
Int([text98]*[text99]/100), Int([text98]*[text99]/100)+1)

Given Text98 = 10 and Text99 = 3... the result is 3
(.0 decimal = no rounding up)

Given Text98 = 11 and Text99 = 3... the result is 4
(> than .0 decimal = rounding up)
Didn't have a chance to test, but that should do it.

Note: You really should use control names with more meaning that text98
or text99...
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
J

John Spencer

If the number is always a positive number and you want to round it up to the
next integer value than the following should work for you.

= -Int(-[text98]*[text99]/100)

If you just want to round up or down
=Round([text98]*[text99]/100,0)

Or another option (Untested) that should work in ALMOST all cases
= Round(([text98]*[text99]/100) + .49999999),0)

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 

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

Top