Calculation Issues

How to Fix Excel Comparison Fails with Floating-Point Numbers

Kushani NimanthikaKushani Nimanthika Nov 11, 2026 868 views

Question details

Users need to resolve an issue where Excel evaluates two identical-looking calculated decimal values as FALSE during an equality comparison.

How to Fix Excel Comparison Fails Due to Floating-Point Precision
Product
Excel
Device & OS
not provided
Scenario
Comparing calculated decimal numbers using logical equality tests, such as IF statements or direct cell references.
Observed behavior
Excel evaluates the comparison as FALSE despite the displayed values looking identical, due to microscopic floating-point precision differences in the stored binary values.
Before you start

Determine the exact number of decimal places required for your calculations, keeping in mind that visual formatting does not alter the underlying stored values.

Solution 1Recommended

Use the ROUND Function for Equality Comparisons

Wrapping your calculations in the ROUND function forces Excel to compare the actual rounded values rather than the deep binary floating-point numbers.

Because computers process and store decimal numbers in binary format, minor precision variations (such as 0.000000000000001) can naturally occur during mathematical operations. Applying a visual cell format to hide these decimals doesn't change the underlying stored value, which causes strict equality tests to fail.

1
Select the target cell

Click on the cell where you want to write your equality comparison formula or IF statement.

2
Apply the ROUND function to direct references

Instead of directly comparing cell references like =A1=A2, wrap both references in the ROUND function. Type =ROUND(A1, 2)=ROUND(A2, 2) to compare them up to two decimal places.

3
Wrap complex formulas

For calculations directly inside the comparison, wrap the entire expression. For example, use =ROUND(SUM(A1:A2), 2)=ROUND(A4, 2) or =IF(ROUND(A3-A4, 2)=0, 0, "Error").

4
Confirm the calculation

Press Enter to execute the formula. Excel will now evaluate the precision-corrected values and return an accurate TRUE or FALSE.

Use the ROUND Function for Equality Comparisons
Precision as Displayed Alternative: You can force Excel to calculate using only the displayed numbers by enabling 'Set precision as displayed' in Excel Options > Advanced. Use this carefully, as it permanently alters stored data in the workbook.
Powerful Spreadsheet Tool

Solve Calculation and Precision Errors Easily with WPS Spreadsheet

WPS Spreadsheet provides powerful data processing capabilities with full support for advanced calculation functions like ROUND, IF, and SUM. It seamlessly handles precise mathematical logic while offering an intuitive interface for your daily data analysis tasks.

  1. 1. Open your file in WPS Spreadsheet: Launch WPS Office and open your .xlsx spreadsheet containing the precision errors.
  2. 2. Locate the failed comparison: Select the cell that currently contains the FALSE output despite displaying identical numbers.
  3. 3. Modify the formula: Edit the formula bar to include the ROUND function on both sides of your equation, such as =ROUND(A1, 2)=ROUND(A2, 2).
  4. 4. Apply changes: Press Enter. WPS Spreadsheet will instantly calculate the newly rounded equality and display the correct logical result.
Fully compatible with Microsoft Excel (.xlsx) formulas, formatting, and mathematical logic.Includes all essential mathematical and logical functions to quickly fix precision issues.Lightweight, highly responsive, and completely free to download.Built-in error checking for complex formulas and array calculations.
microsoft office alternative - wps office

Frequently Asked Questions

Why does Excel show my decimals as equal but the IF function says FALSE?

Excel calculates decimals in a binary floating-point format, which can create microscopic precision differences up to 15 decimal places deep. The IF function compares these exact underlying binary values, not the rounded display value you see on your screen.

Does changing the cell number format fix floating-point comparison errors?

No. Changing the number format (like decreasing decimal places via the Home tab) only alters how the number visually appears. The underlying stored value remains identical, meaning equality checks will still fail.

What is the difference between TRUNC and ROUND when fixing precision?

The ROUND function rounds a number to the nearest specified decimal place (e.g., 1.005 becomes 1.01), which is generally the best approach for fixing minor arithmetic differences. TRUNC simply cuts off all decimals beyond a certain point without rounding, which might alter your intended calculation result.