I have two numbers, the first, is the original price, the second, is the discounted price.
I need to work out what percentage a user saves if they purchase at the second price.
example
25, 10 = 60%
365, 165 = 55%
What I dont know is the formula to calculate this.
For example:
I see that this is a very old question, but this is how I calculate the percentage difference between 2 numbers:
So, the percentage difference from 30 to 40 is:
The percentage difference from 40 to 30 is:
In php, I use a function like this:
This is function with inverted option
It will return:
The formula would be
(original - discounted)/original
. i.e. (365-165)/365 = 0.5479...100% - discounted price / full price
I know this is fairly old but I figured this was as good as any to put this. I found a post from yahoo with a good explanation:
Original Post