Round Up in Access 2002

G

Guest

I am having a problem with Access rounding up to the nearest whole number.
Example: 2.5 should round up to 3.

I have looked everywhere in help, there is not a RoundUp function. HELP!!!!!
 
D

DBS

In mathematics, that would be a "Ceiling" function.
There's probably one available is some library somewhere,
but it's probably simpler to create a public function and
call it. Here's what I came up with, using the Round
function:

-----------------------------------------
Public Function RoundUP(RoundMe As Double)

Dim RoundAnswer As Double

RoundAnswer = Round(RoundMe, 0)

If RoundAnswer < RoundMe Then
RoundAnswer = RoundAnswer + 1
End If

RoundUP = RoundAnswer

End Function
-----------------------------------------

You should be able to call that function in a query or
whatever with the following syntax:

RoundUP(NumericVariable)


Hope that helps!

DBS (David Staas)
 
G

Guest

Hi David,
Are you saying I should customize a function? I am at in Intermediate level
with Access and am having trouble understanding the below. I am trying to
duplicate a formula I had in Excel, into Access. Excel had a RoundUp
function that I frequently used.

Please advise
Tiffani
 
G

Guest

Hi David, I figured that you were talking to create a Module. I created the
module, however, I am trying to build the expression and am having trouble.
My expression in a calculated field in Query Design looks like this Total
Qty:= RoundUP(NumericVariable)[Qty Ord]*[Pck]/[MED Item Allowable]).

can you help with how I should be phrasing?
 
G

Guest

David THANKS! You were telling me to write a new module. I did it and it
works!!!Yeah!!!
 
V

Van T. Dinh

Use the expression:

-Int(-YourNumber)

For example:

?-Int(-2.5)
3

If YourNumber can be negative, chect whether you want to
use Int() or Fix().

HTH
Van T. Dinh
MVP (Access)
 
G

Guest

If any number greater than a whole number should be rounded up, you can do
this in a query with the following:
int(NumToRoundup) +1
 
D

david epsom dot com dot au

Int(1.0) + 1 = 2

Roundup(1.0) = 1

(david)

JasDal said:
If any number greater than a whole number should be rounded up, you can do
this in a query with the following:
int(NumToRoundup) +1
 

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