Fix an Excel IF Formula That Treats Equal-Looking Numbers as Different
Question details
Compare two numbers that appear equal but produce different results in an Excel IF formula.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- One cell contains a value calculated from decimals, while another contains a manually entered value with the same displayed number.
- Observed behavior
- An exact equality test in the IF formula reports that the two values are different.
Check the values and formulas in cells N15 and N44, and decide how much difference is acceptable for your data. Displaying more decimal places may reveal differences, but displayed formatting does not change the underlying values.
Compare the Numbers Within a Tolerance
Use this method when small floating-point differences should not affect the result.
Decimal calculations can produce tiny differences in stored floating-point values, even when cells display the same number. A tolerance treats values as equal when their absolute difference is smaller than the chosen limit.
Decide on a limit that is larger than likely calculation error but small enough for your data. For example, use 0.000001 if a difference smaller than that is acceptable.
Select the cell for the result and enter =IF(ABS(N15-N44)<0.000001,"OK","Oops"). Replace N15 and N44 with your own cell references if needed.
Press Enter. Excel returns OK when the absolute difference is smaller than the tolerance and Oops otherwise.

Round the Difference Before Testing It
Use this method when testing whether the difference rounds to zero at a defined number of decimal places is appropriate.
Compare Equal-Looking Numbers in WPS Spreadsheets
Use an IF formula with ABS in WPS Spreadsheets to compare numbers within a tolerance without changing the original values.
- 1. Open the spreadsheet: Open WPS Spreadsheets and use Open to select your Excel workbook.
- 2. Choose a result cell: Click an empty cell where you want the comparison result to appear.
- 3. Enter the formula: Type =IF(ABS(N15-N44)<0.000001,"OK","Oops") in the cell or formula bar. Adjust the references and tolerance to suit your data.
- 4. Review and save: Press Enter to check the result, then select Save to keep the formula in your workbook.

Frequently Asked Questions
Why does Excel say two numbers are different when they look the same?
Cell formatting can display the same rounded number for values that differ internally. Decimal calculations can also introduce tiny floating-point differences, so an exact equality test may return FALSE.
How do I choose the right tolerance?
Choose a tolerance larger than the likely calculation error but smaller than any difference that matters for your data. In =IF(ABS(N15-N44)<0.000001,"OK","Oops"), replace 0.000001 with your chosen limit.
Will showing more decimal places fix the comparison?
No. Increasing decimal places through Home > Number can help you inspect displayed values, but formatting does not change the underlying numbers used by the formula.
Does rounding the difference change the original cell values?
No. A formula such as =IF(ROUND(N15-N44,4)=0,"OK","Oops") rounds the calculated difference for that comparison; it does not modify N15 or N44.




