Quick, clean, and to the point

Difference is within specific percentage

Excel formula: Difference is within specific percentage
Generic formula 

To test the difference between two values, and return a message when the difference is less or greater than a target percentage you can use a formula based on the IF function and the ABS function. In the example shown, the formula in E5, copied down, is:


where target is the named range G5. In cell E5, the result is "Yes", because the difference in D5 is less than or equal to 5%.


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:


After converting this to cell references, we have:


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:


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.


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:


The result is the same, but this version does not need to use column D as a helper column.

Dave Bruns

Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.

Download 100+ Important Excel Functions

Get over 100 Excel Functions you should know in one handy PDF.