Two calculated numbers that should be equal sometimes differ by a tiny rounding amount. Compare them within a tolerance — ABS(difference) ≤ epsilon — instead of demanding exact equality.
The example
Near-equal values pass the tolerance test.
| A | B | |
|---|---|---|
| 1 | Compare | Equal±0.01? |
| 2 | 10.001 vs 10.000 | TRUE |
| 3 | 10.5 vs 10.0 | FALSE |
The formula
Close enough, not exactly equal:
How it works
Test the size of the difference:
A2 − B2is the difference;ABSignores its sign.- Compare to a small tolerance (epsilon):
<= 0.01means within a cent,<= 0.000001for tighter math. - TRUE means “equal for practical purposes,” even when floating-point math leaves a microscopic difference.
- Alternative: compare after rounding both —
ROUND(A2,2)=ROUND(B2,2).
Why exact equality fails: 0.1+0.2 isn’t exactly 0.3 in binary floating point, so =A2=B2 can be FALSE for values that look identical. A tolerance comparison (or rounding) is the robust fix.
Try it: interactive demo
Two values + a tolerance.
Variations
Round then compare
To 2 decimals:
Percent tolerance
Within 1%:
Flag mismatches
Audit:
Pitfalls & errors
Floating point isn’t exact. Don’t use =A2=B2 on calculated decimals — tiny binary errors cause false negatives.
Pick the right epsilon. Too tight and rounding noise fails; too loose and real differences slip through.
Percent vs absolute. A fixed tolerance suits similar magnitudes; use a relative (percent) tolerance across very different scales.
Practice workbook
Frequently asked questions
How do I compare two numbers within a tolerance in Excel?
Why does =A2=B2 return FALSE for equal-looking decimals?
How do I use a percentage tolerance?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class