Explanation
In this example, the goal is to decrease the prices shown in column C by the percentages shown in column D. For example, given an original price of $70.00, and an decrease of 10% ($7.00), the result should be $63.00. The general formula for this calculation, where “x” is the new price, is:
x=old*(1-percentage)
x=70*(1-10%)
x=70*0.90
x=63.00
Converting this to an Excel formula with cell references, the formula in E5 becomes:
=C5*(1-D5)
=70*(1-0.1)
=70*0.9
=63.00
As the formula is copied down, the formula returns a new price for each item in the table, based on the percentages shown in column D.
Negative percentages
A negative percentage will have the effect of increasing the original price. For example, with -10% in cell D5 (-0.10), the formula evaluates like this:
=C5*(1-D5)
=70*(1--0.1)
=70*1.10
=77.00
This example explains the general formula for increasing a number by a given percentage.
Formatting percentages in Excel
In mathematics, a percentage is a number expressed as a fraction of 100. For example, 95% is read as “Ninety-five percent” and is equivalent to 95/100 or 0.95. Accordingly, the values in column D are decimal values, with the Percentage number format applied.
Explanation
In this example, the goal to calculate the difference as a percentage between two values then check the result to see if its within a given target percentage. The values come from the Expected and Actual columns in the worksheet. The challenge is that the difference might be negative or positive, and we need to cater to both.
Difference as percentage
To calculate the difference as a percentage, we can use a general formula like this:
=(actual-expected)/expected
After converting this to cell references, we have:
=(C5-B5)/B5
As the formula is copied down, it returns a percentage difference in each row. Note that some values are negative.
Note: the results are decimal values like 0.05 and they must be formatted with the percentage number format to display as 5%, 7%, etc.
Compare to target
To compare the percentages to the target percentage, we use the IF function like this in cell E5:
=IF(ABS(D5)<=target,"Yes","No")
where target is the named range G5. This formula uses the ABS function to convert the percentages in column D to positive numbers. Then it uses the IF function to compare the result from ABS to the target (set to 5% in the example shown). If the logical test returns TRUE, the difference is within 5% and IF returns “Yes”. Otherwise, IF returns “No”. Notice both results are text values wrapped in double quotes ("").
As the formula is copied down, we get a new result in each row. If the value in G5 is changed to a new percentage, all results recalculate.
All-in-one-formula
In the example shown, column D is used to calculate the difference as a percentage, in order to make the example easier to understand. However, you can combine both formulas above into a single formula like this if needed:
=IF(ABS((C5-B5)/B5)<=target,"Yes","No")
The result is the same, but this version does not need to use column D as a helper column .