RoundUP Function for Access 2000

E

Ed Jones

I am trying to round up a number for a query that I have
created, but I can't seem to find the proper syntax.
RoundUp isn't listed as a Built_In function and "RoundUP
(fieldname,number)" didn't work. Anybody know the proper
formula for Access?
 
B

Bob Sullivan

Hello

Access naturally rounds numbers up by default. So if you simply format your fields to the number of decimal places you'd like to see, Access will round the number for you. To do this, set your field property to "Fixed" format, and set the number of decimal places to the number you'd like to display

Bob Sullivan
 
D

Douglas J. Steele

Formatting a field does not change its value. Just because 1.456 is
displayed as 1.5 doesn't mean that it is 1.5!

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Bob Sullivan said:
Hello,

Access naturally rounds numbers up by default. So if you simply format
your fields to the number of decimal places you'd like to see, Access will
round the number for you. To do this, set your field property to "Fixed"
format, and set the number of decimal places to the number you'd like to
display.
 
E

Ed Jones

Bob,

Thanks for the idea. I tried it, but it did not work. It
is rounding using the standard rule (over .5 rounds up and
under.5 rounds down). I am trying to round up in a query
that I have created. I have a field of unrounded numbers
and I want to round them up for the query. Any other ideas?
 
E

Ed Jones

Doug,

Do you have a reccommendation on how I can round a number
up so that .25 becomes 1 (not just formatted)?
 
D

Douglas J. Steele

Something like Int(MyNumber + .9999), or Fix(MyNumber + .9999), although I
think you'll have to play with that a little if your data can be negative
numbers.

The difference between Int and Fix is that if number is negative, Int
returns the first negative integer less than or equal to number, whereas Fix
returns the first negative integer greater than or equal to number. For
example, Int converts -8.4 to -9, and Fix converts -8.4 to -8.
 
E

Erik Oosterop

You can create your own ceiling function to use in your query.

Function Ceiling(Number As Double) As Long
Ceiling = -Int(-Number)
End Function

Sometimes this one is shown, but it does not seem to work properly (try an
already rounded number: ceiling(2.0) becomes 3) - but this may be VB version
dependent??
Here it is so you can choose your own:
Ceiling = Cdbl(Clng(Number + 0.5))
 
V

Van T. Dinh

Try:

-Int(-[YourNumber])

if your number is always positive.

HTH
Van T. Dinh
MVP (Access)
 

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