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.
Note that some values are negative.
This formula uses theABS functionto convert the percentages in column D to positive numbers.
If the logical test returns TRUE, the difference is within 5% and IF returns “Yes”.
Otherwise, IF returns “No”.
Notice both results aretext valueswrapped 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.
More than one condition can be tested by nesting IF functions.
The IF…
ABS Function
The Excel ABS function returns the absolute value of a number.
ABS converts negative numbers to positive numbers, and positive numbers are unaffected.