Rounding

  • Thread starter Thread starter Les
  • Start date Start date
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)?
 
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.
 
.... unless the value is already an integer ;-)

Could be something like...
RoundedUp: Int([MyField])+IIf([MyField]>Int([MyField]),1,0)
 
Or, if it's always a positive integer:

Int(-TheNumber)

Or, to catch both positive and negative:

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

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