Results 1 to 8 of 8
  1. #1
    chalupabatman is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    114

    Round Function

    I want this query to only show 2 decimal places. How can I do such?



    Code:
    Calculation: Nz([Red],0)-(Nz([Blue],0)+Nz([Green],0)+Nz([Yellow],0)+Nz([Red],0)+Nz([Salmon],0)+Nz([Mustard],0)+Nz([Orange],0)+Nz([Macaroni],0)+Nz([Small],0)/(1-0.41))

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722

  3. #3
    chalupabatman is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    114
    Quote Originally Posted by orange View Post
    See if this Round info helps.
    DO I have to put the round() function on each field in my query or can I encompass the entire equation in it like this
    Code:
    Calculation: ROUND(Nz([Red],0)-(Nz([Blue],0)+Nz([Green],0)+Nz([Yellow],0)+Nz([Red],0)+Nz([Salmon],0)+Nz([Mustard],0)+Nz([Orange],0)+Nz([Macaroni],0)+Nz([Small],0)/(1-0.41)),2)

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Encompassing the whole thing will work just fine, just verify you get the result you expect.


    Out of curiousity why you are dividing by 1 - .41 rather than .59?

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722

  6. #6
    chalupabatman is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    114
    Quote Originally Posted by rpeare View Post
    Encompassing the whole thing will work just fine, just verify you get the result you expect.


    Out of curiousity why you are dividing by 1 - .41 rather than .59?

    You know that is an excellent question. That is the formula that was given to me to use (converting an Excel spreadsheet into a database or trying rather...) --- hadn't thought twice about double checking the formula.

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I'm only pointing it out because I really try to avoid hard coding formulas if I can avoid it to allow the database to be as flexible as possible. If that is a value that can change over time it should be accounted for in your database design.

  8. #8
    chalupabatman is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    114
    Quote Originally Posted by rpeare View Post
    I'm only pointing it out because I really try to avoid hard coding formulas if I can avoid it to allow the database to be as flexible as possible. If that is a value that can change over time it should be accounted for in your database design.
    That is a very good thought and question. I will inquire on that one.

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

Similar Threads

  1. Replies: 5
    Last Post: 03-24-2016, 02:26 AM
  2. Round Function
    By gcgoode in forum Access
    Replies: 2
    Last Post: 08-07-2015, 11:08 AM
  3. Always Round Up (Never Down)
    By Derrick T. Davidson in forum Queries
    Replies: 3
    Last Post: 07-23-2013, 10:08 PM
  4. round up
    By Rhubie in forum Access
    Replies: 1
    Last Post: 08-29-2012, 05:14 PM
  5. Round Up/Down 4 Decimals to 2
    By newbie in forum Access
    Replies: 6
    Last Post: 10-18-2010, 02:58 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