SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2005
    Location
    Orange County, CA, Unites States
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Trying to calculate percentage saved

    Our store software currently displays the total amount saved (the list price minus our price) for every product using the code below:

    'Calculate "YouSave"
    If Product_ListPrice > 0 Then
    Product_YouSave = Product_ListPrice - Product_LowestPrice
    End If

    I, however, would like to also diplay the percentage saved next to the amount saved. I tried using the code below but it won't work. Can someone help me out?

    'Calculate "YouSavePercent"
    If Product_ListPrice > 0 Then
    Product_YouSavePercent = ((1 - (Product_LowestPrice / Product_ListPrice) * 100)
    End If

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have an extra open parenthesis on the line that does the calculation.


Bookmarks

Posting Permissions

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