Results 1 to 7 of 7
  1. #1
    spyldbrat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2015
    Posts
    73

    Formula in a Query

    I am trying to determined the gross profit $ and gross profit% in a query. I was able to create a calculation to determine the dollars, but that calculation I did the % is not calculating correctly. I used the following formula: ([Bill Amount]-[Pay Amount])/[GP Dollars] Can someone tell me the correct calculation?

    Thank you.

  2. #2
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Lets say your cost price = $15 and your selling price = $20 then your profit = $5 and your % profit = 100*(20-15)/15 = 33.3%

    I'll leave you to convert that to a general formula
    HTH

  3. #3
    spyldbrat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2015
    Posts
    73
    When I try to run the Query, I am getting the following error message: Your query does not include the specified expression '100*([Bill Amount]-[Pay Rate])/[Pay Rate]' as part of an aggregate function?

    Below is the formula:
    GP Per:100*([Bill Amount]-[Pay Rate])/[Pay Rate]

  4. #4
    spyldbrat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2015
    Posts
    73
    Disregard my previous post -- I got it to run without the error but the % is still showing the wrong amount:

    The GP $ is 98,628.52
    The Pay Amount is 364,259.51
    GP % is 14,8429.70%

    it should show 21.31 %

    This the formula I used:

    GP Per: Sum(100*([Bill Amount]-[Pay Amount])/[Pay Amount])

  5. #5
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    You're summing the percentage - I don't think you should be ?

  6. #6
    spyldbrat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2015
    Posts
    73
    If I remove the sum, I get an expression error. What should I put in in it's place?

  7. #7
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    If you are formatting your query field as a %, you should omit the 100 multiplier
    Agree that sum isn't required

    I don't understand how you get the answer to be 21.31%
    The reason I didn't give a generic formula with field names is that I found your names confusing...and still do.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

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

Similar Threads

  1. Replies: 19
    Last Post: 07-13-2015, 10:15 AM
  2. Replies: 41
    Last Post: 05-29-2015, 02:58 PM
  3. Formula in Query
    By LeadTechIG in forum Queries
    Replies: 6
    Last Post: 05-12-2015, 05:50 AM
  4. Need help with Query formula
    By krymer in forum Queries
    Replies: 5
    Last Post: 09-30-2010, 06:51 AM
  5. Help with formula for Query
    By goldie6175 in forum Queries
    Replies: 1
    Last Post: 02-18-2010, 11:29 AM

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