Results 1 to 4 of 4

Thread: Rounding up...

  1. #1
    Join Date
    Jul 2004
    Posts
    34

    Angry Unanswered: Rounding up...

    Hi,

    A simple enough question you'd think - but one that has caused me much torment!

    I want to round some numbers up, that's it. I tried to use the ROUNDUP() function, but got a message saying it wasn't defined? Could anyone tell me what the problem could be, or an alternative way of achieving the same result?

    I tried the function in both a query and module and got the same result!?

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    Roundup() does not exist. You have to make it yourself. Check this site for one example:

    http://www.mvps.org/access/modules/mdl0054.htm

    There are several rounding examples for Access on the internet

  3. #3
    Join Date
    Jul 2004
    Location
    Southampton, UK
    Posts
    368
    Hi
    The following will round up to the next whole number with a certain range of numbers (1.4 is rounded to 2, -1.6 is rounded to -1):

    Int([myDouble]+0.999999)

    Also, this will round up to 2 decimal places:

    Int(([myDouble]*100)+0.999999)/100

    Might give you some ideas. Should work to six dp providing your numbers aren't too big.
    Chris

  4. #4
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    You can also try:

    Dim lngNumber as Long
    dim lngRoundNumber as Long

    lngNumber = 3.21
    lngRoundNumber = Fix(lngNumber)
    lngRoundNumber = IIf((lngNumber - lngRoundNumber) = 0 , lngNumber , lngNumber+1 )

    Won't really work for negative numbers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •