Round Off Up or down formula

R

Rashid Khan

Hello Group,

I am using Access 2002. I have the following problem:

Example No. 1
Line 1) Sub_Total : 1,234.52
Line 2) Round_off : + 0.48
Line 3) Grand_Total : 1,235.00

My problem is that if the Sub_Total ends with 0.50 and greater then the
round off should be up to the next whole number and the value in No.2
Round_off should show the amount by which it is rounded up which in this
case is +0.48 and rounded up to 1,235 (as shown in the Line 3) Grand_Total).


Example No. 2
Line 1) Sub_Total : 1,234.47
Line 2) Round_off : -0.47
Line 3) Grand_Total : 1,234.00

And if the Sub_Total is less than 0.49 or less then the round off should be
down to the whole number and the value in Line No.2 should show the amount
by which it is rounded down which in this case is -0.47 and rounded down to
1,234.00 (as shown in Line 3) Grand_Total)

I have searched the newsgroup but could not find any suitable formula for
rounding off in Line no.2. In plain english it means "TEST THE DECIMAL VALUE
IN SUB_TOTAL AND IF IT IS 0.49 OR LESSER THEN SHOW THE VALUE IN LINE 2) BY
WHICH IT IS ROUNDED DOWN AND IF IT IS 0.50 OR GREATER THEN SHOW THE VALUE
IN LINE 2) BY WHICH IT IS ROUNDED UP.

Would appreaciate the formula for Line 2) Round_off.

TIA

Rashid Khan
 
R

Rolls

Use the INT() function to calculate Line3 = int([line1]+0.50), then
calculate Line2 = Line3 - Line1
 
R

Rashid Khan

Thanks a lot...works fine.. will revert back if there are any further
problems.

Thanks once again.

Rashid Khan
 

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