Formula Errors

Fix Excel IF Formula Results for Matching Values

Rana GarciaRana Garcia Nov 18, 2026 870 views

Question details

The user needs an IF formula to compare values that appear identical in Excel.

Fix Excel IF Formula Results for Matching Values
Product
Microsoft Excel
Device & OS
not provided
Scenario
An IF formula compares two cells and returns a dash when they match or zero when they differ.
Observed behavior
Some comparisons return unexpected results even though the displayed values appear identical.
Before you start

Identify the two cells being compared and the decimal precision relevant to your data. Use Home > Increase Decimal to check whether the displayed values hide decimal differences.

Solution 1Recommended

Round both values before comparing them in Excel

Use this method when calculated values look identical but differ in digits beyond the displayed precision.

1
Inspect the values

Select the cells being compared and use Home > Increase Decimal to display more decimal places.

2
Update the IF formula

Select the result cell and enter =IF(ROUND(A1,9)=ROUND(B1,9),"-",0), replacing A1 and B1 with your actual cell references.

3
Choose the precision

Change both instances of 9 to the number of decimal places appropriate for your data, then press Enter.

4
Apply the formula

Drag the result cell's fill handle down to apply the formula to other rows, and check the results.

Round both values before comparing them in Excel
Keep zero numeric: Use 0 without quotation marks if you want a numeric zero. The dash remains a text result.
Compare values in WPS Spreadsheets

Compare rounded values with IF in WPS Spreadsheets

Use IF and ROUND in WPS Spreadsheets to compare values at the precision your worksheet requires.

  1. 1. Open the workbook: In WPS Spreadsheets, select Open and choose your Excel workbook.
  2. 2. Enter the comparison: Select a result cell and enter =IF(ROUND(A1,9)=ROUND(B1,9),"-",0), replacing the references with the cells you want to compare.
  3. 3. Set the precision: Change both instances of 9 to the required number of decimal places and press Enter.
  4. 4. Copy and save: Drag the fill handle to apply the formula to other rows, then select Save to save the workbook.
Compare calculated values after rounding to a chosen decimal placeOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formulas and fill handlesWork with a free, easy-to-use office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why do matching-looking numbers return different IF results?

Excel compares underlying values, not just the displayed digits. Calculated numbers can differ beyond the visible decimal places; use Home > Increase Decimal to inspect them or ROUND both values before comparing.

How many decimal places should I use in ROUND?

Use the precision required by your data. For example, use ROUND(A1,2) and ROUND(B1,2) when comparing amounts to two decimal places.

Why should I use 0 instead of "0" in the formula?

In =IF(ROUND(A1,9)=ROUND(B1,9),"-",0), 0 returns a number, while "0" returns text. Use the numeric result if you need to use it in calculations.

What if rounding does not fix the comparison?

Check whether the cells contain numbers or text by entering =ISNUMBER(A1) and =ISNUMBER(B1) in empty cells. If a value is stored as text, convert it to a number when appropriate, then compare again.