Rounding Up and Down

A

A Hopper

I would like to divide a number and have the answer round
up and down to the nearest 10, 100.

Example One:
50 / 2 = 25
Round down to 20
Round up to 30

Example Two:
2000 / 6 = 333.3
Round down to 300
Round up to 400

If the number is divisible by 6 then both answers would be
the same.
6000 / 6 = 600

I am most interested in Example Two rounding to 100.

Thanks for your help.

Allan
 
A

Arni Laugdal

This is a few step process:
A: In stead of deviding with 6 devide with 600.
B: Then add +0.499999 for RoundUp
or -0.499999 for RoundDown.
C: Use Round to cut all decimals.
D: Multiply with 100.

In other words:
=Round(2000/600+0,49999;0)*100 is 400
=Round(2000/600-0,49999;0)*100 is 300

Enjoy,
Arni Laugdal,
MS Office 2000 Master Instructor
www.tv.is/msaccess
 
A

Allen Browne

Copy Ken Getz' rounding function from this link:
http://www.mvps.org/access/modules/mdl0054.htm

From memory, it accepts a negative number for the NumDigits argument. Use -1
to round to the nearest 10, -2 to round to the nearest 100, etc.

If you are using Access 2000 or later, you may want to rename the function
so it does not fight with the built-in Round() function.
 
A

A Hopper

Allen
Sorry for the late reply. Thank you for your help. I am
going to try the function at some point today.

Allan
 
A

A Hopper

Arni
Thank you very much for your help. I hope to be able to
get this part of my calculation working today.

Allan
 

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