You are here:

# Excel/calculation error on excel

Question

calculation error
Hello,
It seems that Excel does not recognize a zero when the equation leading to zero involves numbers that are not integers and when the equation involves an empty cell (or a cell equal to zero). it is difficult to describe without an example.
I enclose a screen shot of simple calculations (row 2 shows the formulae entered in row 3). The total of each equation should be equal to zero, but it is not (see True, false).
Do you know if it is a well known documented problem in Excel? I cannot find any trace of this anywhere. I thought that considering your experience, you might know more about this.
i would really appreciate if you could let me know if there is some documentation about it somewhere.
thanks a lot.
Caroline

Caroline,

It is a well known problems that computers in general have problem with representing floating point numbers.  Just like decimal numbers have problems representing some numbers exactly such as 1/3 and 1/7.  Most applications represent these numbers using the IEEE standard as does excel.  So those problems are inherent in non-integer numerical representation and storage in a computer and these problems evident in Excel.  Over the various excel versions, microsoft has tried to overcome this problem by doing some internal rounding - but i tis not perfect.  In you first example, where you get True, I suspect excel has intervened and corrected the result.  In your other two renditions, I suspect the adding of the third term prevents excel from performing the corrective algorithm.

Generally when working with floating point (non-integer) numbers, it is best to do overt rounding or account for these imperfections when doing comparisons.  For example, to check for zero you might do

=if(abs(A1)<.000000001,0,A1)

so you are defining any result smaller than that very small number to actually be zero.

Here is a microsoft support article that gives a good explanation
http://support.microsoft.com/default.aspx?scid=kb;en-us;78113
Floating-point arithmetic may give inaccurate results in Excel

a much larger article.
http://support.microsoft.com/default.aspx?scid=kb;en-us;42980
(Complete) Tutorial to Understand IEEE Floating-Point Errors

another
http://support.microsoft.com/default.aspx?scid=kb;en-us;48606
XL: Comparison of Values Does Not Return Correct Result

one on how to work within the problem
http://support.microsoft.com/kb/214118/
How to correct rounding errors in floating-point arithmetic

--
Regards,
Tom Ogilvy
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Tom Ogilvy

##### Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

##### Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.