Results 1 to 4 of 4
  1. #1
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85

    Rounding

    I have a formula - Round(20*(([PackPrice]/20)+5),0)/20) - this round up if over 5 and down if under



    I now need to just round up - how would I change this formula to do that?

    This is the actual code:

    BookPrice: IIf([WBCode]="03-N0051" Or [WBCode]="03-N0061",Null,Round(20*(([PackPrice]/20)+5),0)/20)

    I am trying to match the way that QuickBooks rounds -

    If I don't round in either Access or QuickBooks - the numbers come out the same - 37.224
    Last edited by Rhubie; 05-30-2013 at 10:17 AM. Reason: Added actual code and more explanation of what I have tried

  2. #2
    AlexHedley's Avatar
    AlexHedley is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    England
    Posts
    180

    Rounding

    How about
    Code:
    INT(x)+1
    x being your formula not using Round.

    http://599cd.com/tips/access/round-int-fix/

  3. #3
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85
    This is what I had first: It returns 37.20 in Access - In QuickBooks I have it round up to the nearest .05 - it returns 37.25

    NBHalfPack: [BookPrice]-(Round(20*([BookPrice]*[PercentHalf]),0)/20)
    Book Price is 39.60, PercentHalf = 6%

    Then I tried:
    Test: [BookPrice]-(Int(-100*([BookPrice]*[PercentHalf]))/-100)
    It returned 37.22

    Then I tried yours:

    Test: [BookPrice]-Int([BookPrice]*[PercentHalf])+1
    It returns 38.60

    I need to have Access round up the same as QuickBooks.

  4. #4
    AlexHedley's Avatar
    AlexHedley is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    England
    Posts
    180
    Code:
    [BookPrice]-(Round(([BookPrice]*[PercentHalf]),1))+0.05
    Also add an IIF to check the round is <5 or >=5 then add 0.05

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

Similar Threads

  1. Rounding numbers
    By jlgray0127 in forum Forms
    Replies: 5
    Last Post: 03-02-2012, 12:55 PM
  2. Rounding Time
    By nknigi in forum Access
    Replies: 2
    Last Post: 01-09-2012, 11:10 AM
  3. rounding down
    By markcranmer in forum Queries
    Replies: 1
    Last Post: 10-11-2011, 09:43 AM
  4. Rounding
    By BLD21 in forum Reports
    Replies: 5
    Last Post: 06-20-2011, 01:06 PM
  5. Rounding off
    By Alex Motilal in forum Access
    Replies: 4
    Last Post: 12-20-2009, 12:47 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