Results 1 to 6 of 6
  1. #1
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581

    Rounding up


    Is there a way to round up to the next whole number in a query?

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You could create your own User Defined Function to do it, or use a formula something like this:
    RoundUP: IIF([NumField] =Int([NumField]),[NumField],Int([NumField])+1)
    where
    NumField is the name of your field.

  3. #3
    Preston is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2017
    Posts
    55
    Wouldn't
    Int(NumField+1)
    work for all positive numbers?.
    Int() truncates the decimal places, so both 3.9 and 3.1 would result in 4. To handle negative numbers, iif(NumField<0,-INT(ABS(NumField)+1),Int(NumField)+1)

  4. #4
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    That was great. Thanks. It worked perfectly.

  5. #5
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Wouldn't
    Int(NumField+1)
    work for all positive numbers?.
    I don't think so.
    What if the number is exactly equal to a whole number (i.e. 3)?
    Then it round return 4 instead of 3.

  6. #6
    Preston is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2017
    Posts
    55
    Yep, you're right. The NumField=int(numfield) condition would have to be added.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. rounding up
    By slimjen in forum Queries
    Replies: 1
    Last Post: 02-21-2017, 04:16 PM
  2. Why Is It Rounding?
    By bgwool in forum Access
    Replies: 4
    Last Post: 12-10-2014, 06:24 PM
  3. Rounding
    By Rhubie in forum Queries
    Replies: 3
    Last Post: 05-30-2013, 10:55 AM
  4. rounding down
    By markcranmer in forum Queries
    Replies: 1
    Last Post: 10-11-2011, 09:43 AM
  5. Rounding
    By BLD21 in forum Reports
    Replies: 5
    Last Post: 06-20-2011, 01:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums