Rounding

L

Les

In a table or query, is there a way I can force it to
always round UP to the nearest whole number (1.1 would
round up to 2)?
 
J

Jeff Boyce

Les

First, I'd suggest a query for this, as changing 1.1 to 2 loses some
information.

One way to do this in a query would be to find the integer value, then add
one. Check on the CInt() function in Access HELP.
 
S

Steve Schapel

.... unless the value is already an integer ;-)

Could be something like...
RoundedUp: Int([MyField])+IIf([MyField]>Int([MyField]),1,0)
 
K

Ken Snell

Or, if it's always a positive integer:

Int(-TheNumber)

Or, to catch both positive and negative:

IIf(TheNumber>0, Int(-TheNumber), CInt(TheNumber))
 
S

Steve Schapel

Ken,

I could agree if you put another - in there...
-Int(-[TheNumber])
:)
Man, I just gotta watch you and Jeff like a hawk! <g>
 
K

Ken Snell

A - here, a - there...... yep!

Thanks!

--

Ken Snell
<MS ACCESS MVP>

Steve Schapel said:
Ken,

I could agree if you put another - in there...
-Int(-[TheNumber])
:)
Man, I just gotta watch you and Jeff like a hawk! <g>

--
Steve Schapel, Microsoft Access MVP

Ken said:
Or, if it's always a positive integer:

Int(-TheNumber)

Or, to catch both positive and negative:

IIf(TheNumber>0, Int(-TheNumber), CInt(TheNumber))
 

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