Formulas & Functions•6 min read
Excel Floating-Point Errors: Why 0.1 + 0.2 Misbehaves
Understand Excel floating-point errors, equality surprises, currency rounding, and safer formulas for precise results.
SheetHub••6 min
A cell can display 0.30 while Excel calculates with a value that is just above or below 0.30. That difference is normally invisible, but an equality test can expose it: a formula that appears to ask whether two amounts match may return
Try these formulas in separate cells:
The first result is displayed as
Most decimal fractions cannot be represented exactly with a finite binary fraction. The number 0.5 can be represented exactly because it equals one-half. The number 0.1 repeats when expressed in binary, so Excel stores the closest available approximation instead.
Excel keeps up to 15 significant digits for numeric precision. That limit is separate from the number of decimal places shown by a cell format. A format such as
Floating-point differences usually matter at a boundary where Excel must decide whether two values are the same, whether a threshold has been crossed, or how a total should be posted.
Round at the point where the business meaning requires a fixed precision. For a two-decimal currency result, round the calculation itself:
If A2 and B2 are amounts that should be combined as cents, this produces a value rounded to two decimal places, not merely a value that looks rounded. For a comparison, round both sides to the same policy:
You can also compare within a documented tolerance when the data is a measurement rather than a financial amount:
The tolerance should reflect the measurement's meaningful precision. Do not copy a tiny tolerance into every workbook without understanding the units involved.
For line-item pricing, choose a consistent policy. One model rounds each line before summing; another keeps extra precision through the detail calculations and rounds only the invoice total. Both can be valid, but mixing them creates differences that look like errors. Apply the same rule to detail rows, subtotals, and final totals. If the report also hides or filters rows, use the appropriate SUBTOTAL and AGGREGATE totals after deciding how each underlying amount is rounded.
Excel includes a Precision as displayed option under workbook calculation settings. When enabled, Excel permanently changes stored values to match the number of displayed decimal places. A value displayed with two decimals may have its extra digits discarded when the workbook recalculates.
That can make equality tests and totals appear consistent, but it changes the data itself. The change can be irreversible after the workbook is saved, so do not enable the setting as a quick fix for a single comparison. It can also affect formulas, exports, and later reports that need the original precision.
A safer default is to keep the underlying values and use explicit
When a result differs by a tiny amount, follow this sequence:
Excel floating-point errors are small representation differences that become visible when formulas compare, accumulate, or filter numeric values. A cell format changes appearance, not calculation precision. Use
FALSE. Excel floating-point errors are not damaged data. They come from the way computers represent decimal numbers in binary.
Why 0.1 + 0.2 can surprise you
=0.1+0.2
=0.3
=(0.1+0.2)=0.30.3 in a normal worksheet, and the second result is also displayed as 0.3. The comparison can still return FALSE because the stored binary approximations are not necessarily identical. Formatting rounds what you see; it does not automatically round the value used by later calculations.
That distinction matters in a reconciliation sheet. A displayed total of $10.00 may be based on a value such as 10.0000000001, while a comparison value is 10. The cells look equal but are not equal at full precision. If the result becomes #VALUE!, #NUM!, or another visible error for a different reason, use an Excel formula errors guide to separate a floating-point comparison from a genuine formula failure.
How Excel stores decimal numbers
0.00 can make many nearby values look identical, but the underlying calculation still uses the stored number. This is normal behavior in floating-point software, not evidence that Excel has randomly changed a value.
Display formatting is therefore a presentation decision. For example, Excel floating-point errors and custom number formats are related because a custom format can show a value with two decimals, a currency symbol, or a thousands suffix without changing the value in the cell. Use formatting when the report needs a particular appearance. Use a formula when the calculation itself needs a defined precision.
When tiny differences become visible
IF(A2=B2, ...)can fail when both cells display the same rounded amount.- Adding many unrounded prices or tax calculations can leave a tiny remainder in a currency total.
- A number produced by arithmetic may not match a stored lookup criterion that looks identical after formatting.
- A value meant to be exactly 1 can compare as slightly less than or greater than 1.
- A filtered report may show a small discrepancy when detail rows use more precision than the business rule allows.
Fix comparisons and totals deliberately
=ROUND(A2+B2,2)=ROUND(A2,2)=ROUND(B2,2)=ABS(A2-B2)<0.000001Precision as displayed: treat it carefully
ROUND formulas at documented boundaries. If a workbook genuinely requires Precision as displayed, make a backup first, record the chosen decimal places, test important totals, and ensure every user understands that displayed precision becomes stored precision.
Troubleshooting checklist
- Increase the displayed decimal places temporarily so you can see whether the values actually differ.
- Check whether the values came from binary-sensitive arithmetic such as decimal fractions, percentages, tax, or repeated additions.
- Test a rounded comparison with the precision appropriate for the data.
- Find out whether the difference is introduced in each line item, a subtotal, or only the final total.
- Document whether the model rounds each transaction, each subtotal, or only the final result.
- Avoid Precision as displayed unless changing the stored data is intentional and backed up.
Summary
ROUND where the business rule requires a fixed number of decimals, use a tolerance for suitable measurements, and apply one consistent policy across detail and total formulas. Treat Precision as displayed as a deliberate data change, not a harmless display option.Article Topics
Recommended Next Reading
Excel
=EXCEL(...)Excel ROUND Function: MROUND, CEILING & FLOOR Guide
Explore ↗
Excel
=EXCEL(...)Excel LAMBDA Recursive Loops: Advanced Calculations
Explore ↗
Excel
=EXCEL(...)Excel SWITCH Function: Simplify Nested IF Logic
Explore ↗
Share this tutorial
Discussion & Community
Share questions, tips, or edge-cases about this spreadsheet formula.