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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding Numberic fractions to next whole number 2

Status
Not open for further replies.

Dimonet

IS-IT--Management
Oct 17, 2001
65
US
When working within a report I want to output my result so that it rounds any fraction at all to the next whole number. For example:
.25 would round to 1
1.1 would round to 2
etc

Where would I specify this in the query/expression? Please advise.

Thanks,
Dimo
 
Dimo
There may be other ways, but this is one...

In your query, enter an expression column
Int([YourNumberField]+1)

Tom
 
The only issue I have with Tom's expression is if the value is already a whole number like 2. Then the expression rounds it to 3. You could use this expression to round up.
-1*Int(-1 *[NumberField])

This will do what you want.

Paul
 
Another way to write this is
Abs(Int(-1 * [NumberField]))

That's probably a little neater expression.

Paul
 
Oops. Paul is absolutely right. Sorry for that omission in my thinking.

Tom
 
Thank you all very much for your help!
 
Bob Raskew pointed out to me that the expression
Abs(Int(-1 * [Number])
doesn't work with negative values so if you have any negative numbers you should use the original post
-1 * Int(-1 * [Number])

Sorry for the confusion. I claim a Senior moment.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top