Rounding Up to next whole number

B

Brad

Please help. I have a numeric field that contains mostly whole
numbers(eg.100) but has a few numbers with decimals (eg 7.1 or 8.7, etc). I
need help changing this field so all numbers are rounded to the next whole
integer. If I use the round function it will change the 7.1 to 7 and the 8.7
to 9. I need a function that rounds and fraction up. In otherwords 7.1 to 8
and 8.7 to 9, etc.

Any suggestions would be greatly appreciated.

Brad
 
T

Tom Lake

Brad said:
Please help. I have a numeric field that contains mostly whole
numbers(eg.100) but has a few numbers with decimals (eg 7.1 or 8.7, etc).
I
need help changing this field so all numbers are rounded to the next whole
integer. If I use the round function it will change the 7.1 to 7 and the
8.7
to 9. I need a function that rounds and fraction up. In otherwords 7.1 to
8
and 8.7 to 9, etc.

Try Round(n + 0.5)

Tom Lake
 
J

Jim/Chris

From Access help

ROUNDUP
Rounds a number up, away from 0 (zero).

If this function returns the #NAME? error value, you may
need to install msowcf.dll.

Syntax

ROUNDUP(number,num_digits)

Number is any real number that you want rounded up.

Num_digits is the number of digits you want to round to.
Negative rounds to the left of the decimal point; 0 (zero)
or omitted rounds to the nearest integer.

Jim
 
B

Brad

Jim,

In a query "roundup" returns an "undefined function error". I'm using access
2003, which directory to I place msowcf.dll?

Thanks,
Brad
 
J

John Vinson

Jim,

In a query "roundup" returns an "undefined function error". I'm using access
2003, which directory to I place msowcf.dll?

If you have Excel installed, it should already be in WINDOWS\SYSTEM
(or the equivalent directory for your operating system). What you need
to do is tell Access about it!

Open the VBA editor; select Tools... References; scroll down until you
find that DLL and check the checkbox by it.

Alternatively, write your own ROUNDUP() function:

Public Function Roundup(dblX As Double) As Double
If dblX > Fix(dblX) Then
Roundup = Fix(dblX) + 1
Else
Roundup = dblX
End If



John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 

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