Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    percentage in query (Access 2000)

    How can i calculate the percent profit in the query ? i calculate it as ([sellingprice]-[purchaseprice])/[purchaseprice]/100 but i am not sure since i receive inaccurate values.In my query i have chosen the format percent.Is there somehting i miss with the calculation of the percentage?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: percentage in query (Access 2000)

    Omit the /100:

    Profit: ([sellingprice]-[purchaseprice])/[purchaseprice]

    The percentage format will automatically perform the calculation needed (multiply with 100).

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: percentage in query (Access 2000)

    Additional remark: if you have records in which purchaseprice is null (blank) or 0 (zero), division by purchaseprice will result in an error. You can avoid this as follows:

    Profit: IIf(Nz([purchaseprice],0)=0,Null,([sellingprice]-[purchaseprice])/[purchaseprice])

Posting Permissions

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