Fix Excel IF Comparisons for Values That Appear Equal
Question details
The user needs an Excel IF formula to compare calculated values that appear equal.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- An IF formula compares calculated amounts displayed with currency formatting.
- Observed behavior
- The formula returns an unexpected result even though the displayed amounts look identical.
Identify the cells being compared and decide how many decimal places matter for the calculation. Currency formatting may show two decimal places without changing the underlying values.
Round Both Values Before the Excel IF Comparison
Use ROUND on each side of the comparison to ignore differences beyond the precision relevant to your data.
Calculated values can contain small floating-point differences that are hidden by number formatting. Rounding both values makes the comparison use the chosen decimal precision.
In Excel, select the cell containing the IF formula that compares the calculated values.
In the formula bar, enter =IF(ROUND(D2,2)=ROUND(H2,2),"OK","No"), replacing D2 and H2 with your cells.
Replace 2 in both ROUND functions with the number of decimal places appropriate for your data, then press Enter.
If a total should be rounded before later use, select its cell and use a formula such as =ROUND(SUM(H2:H11),2).

Compare Rounded Values in WPS Spreadsheets
Open your workbook in WPS Spreadsheets and use IF with ROUND to compare calculated values at the precision your data requires.
- 1. Open the workbook: In WPS Office, open your Excel workbook in WPS Spreadsheets.
- 2. Select the comparison cell: Click the cell where you want to enter or edit the IF formula.
- 3. Enter the formula: In the formula bar, enter =IF(ROUND(D2,2)=ROUND(H2,2),"OK","No"), adjusting the cell references and decimal places as needed.
- 4. Check the result: Press Enter and review the result in the formula cell; use File > Save to save your changes.

Frequently Asked Questions
Why does Excel say two currency values are different when they look the same?
Currency formatting controls what is displayed, not necessarily the stored value. Calculations can leave small floating-point differences that an equality test detects.
How do I compare values to the nearest cent?
Round both values to two decimal places in the IF formula, for example: =IF(ROUND(D2,2)=ROUND(H2,2),"OK","No").
Can I round a SUM before comparing it?
Yes. Use a formula such as =ROUND(SUM(H2:H11),2) in the total cell, or apply ROUND to the SUM expression within your comparison.
Does rounding guarantee that any two nearly equal values will match?
No. Values on opposite sides of a rounding boundary can round differently. Choose the decimal precision based on how the values should be treated in your calculation.




