Calculation Issues

Fix an Excel IF Formula That Treats Equal-Looking Numbers as Different

Adam DavisAdam Davis Dec 2, 2026 868 views

Question details

Compare two numbers that appear equal but produce different results in an Excel IF formula.

Fix an Excel IF Formula That Treats Equal-Looking Numbers as Different
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.
Before you start

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.

Solution 1Recommended

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.

1
Choose a tolerance

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.

2
Enter the comparison formula

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.

3
Check the result

Press Enter. Excel returns OK when the absolute difference is smaller than the tolerance and Oops otherwise.

Compare the Numbers Within a Tolerance
Tolerance boundary: The < operator excludes a difference exactly equal to the tolerance. Use <= if that boundary should also count as equal.
Compare values in WPS Spreadsheets

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. 1. Open the spreadsheet: Open WPS Spreadsheets and use Open to select your Excel workbook.
  2. 2. Choose a result cell: Click an empty cell where you want the comparison result to appear.
  3. 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. 4. Review and save: Press Enter to check the result, then select Save to keep the formula in your workbook.
Compare calculated decimals without relying on exact equalityOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formulas and cell references
microsoft office alternative - wps office

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.