Round Up

J

jana

I would like for a field to round up a calculation and
then sum off of the rounded up number.

Is there a way to do that?

Thanks.

Jana
 
J

Jim/Chris

From Access help

The default type of Number is a "Long Integer" - which IS
an integer,
that is, a whole number.

Rounds a number to a specified number of digits.

Syntax

ROUND(number,num_digits)

Number is the number you want to round.

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

_____________

ROUNDDOWN
Rounds a number down, toward 0 (zero).

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

Syntax

ROUNDDOWN(number,num_digits)

Number is any real number that you want rounded down.

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.
___________

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
 
M

Marshall Barton

jana said:
I would like for a field to round up a calculation and
then sum off of the rounded up number.


Yes, you can do that. How you would do it depends on what
you mean by "round up".

If you mean you want any fractional part to go to the next
larger integer, then I suggest you create a Public function
in a standard module to do the "rounding". (In math speak,
this is called the Ceiling of the number.)

Public Function Ceiling(varNumber As Variant) As Variant
If IsNumeric(varNumber) Then
If Int(varNumber) = varNumber Then
Ceiling = varNumber
Else
Ceiling = Int(varNumber + 1)
End If
Else
Ceiling = Null
End If
End Function

Then you can use the function anywhere you want to do this
kind of "rounding". In a query or a report footer, the sum
would be like:
=Sum(Ceiling(numberfield))
 

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

Similar Threads


Top