Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Errors When Subtracting.

Errors When Subtracting

Written by Allen Wyatt (last updated October 19, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003


3

Fred expressed some confusion and concern about the results he received when subtracting certain numbers. For instance, when he subtracts 3809717.98 from 3799904.94, he should get -9813.04, but instead gets -9813.04000000003.

What Fred is witnessing is an artifact of Excel's limitations. The problem is ultimately related to how Excel works with floating-point numbers. Computers must store numbers internally as binary values, not as the decimal values we see displayed on the screen. Whole numbers can be stored as binary values relatively easily. When you throw a decimal point into the mix, then storing very large or very small numbers becomes more problematic—Excel just isn't able to store them with absolute precision. Instead, Excel provides an "approximate" result, out to 15 digits (the limits of its precision). Thus, you end up with something like -9813.04000000003, which contain the full 15 digits of precision possible in Excel.

A full discussion of how floating-point numbers are maintained in Excel and computers in general can very quickly get extremely technical. For those who want more information on the topic, here are two places you can start your research:

http://support.microsoft.com/kb/78113
http://download.oracle.com/docs/cd/E19957-01/806-3568/ncg_goldberg.html

The bottom line is that the only way to get the "exact" results you want, to the number of decimal places you want, is to use the ROUND function in your formulas, as shown here:

=ROUND(3799904.94 - 3809717.98, 2)

You can also, if desired, change the precision used to within all formulas by following these steps:

  1. Choose Options from the Tools menu. Excel displays the Options dialog box.
  2. Make sure the Calculation tab is displayed. (See Figure 1.)
  3. Figure 1. The Calculation tab of the Options dialog box.

  4. Ensure that the Precision As Displayed check box is selected.
  5. Click OK.

Now, Excel uses the precision shown on the screen in all of its calculations, instead of doing calculations at the full 15-digit precision it normally maintains.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3354) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Errors When Subtracting.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Generating Unique Sequential Numbers

Using Excel to generate unique sequential numbers for invoices or company statements can be a challenge. Here's ...

Discover More

Numbering on New Paragraph Doesn't Work as Expected

The Numbering feature in Word can be a bit tricky to navigate. Sometimes it works as it should, and other times it seems ...

Discover More

Copying the Quick Access Toolbar

Customization of Word is done, largely, through what you add to or remove from the Quick Access Toolbar. When you have ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (menu)

Summing Digits in a Value

Want to add up all the digits in a given value? It's a bit trickier than it may at first seem.

Discover More

Relative References within Named Ranges

Excel is usually more flexible in what you can reference in formulas than is immediately apparent. This tip examines some ...

Discover More

Getting a Count of Unique Names

When you've got a column full of names, you may want to get a count of how many of those names are unique. You can make ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 - 0?

2023-10-12 07:55:06

Samir Shah

When I am trying to subtract Form.textbox.value -cell value which is 49.046 in both. the result it gives 7.105.......E-15 instead of 0. After selecting Precision As Displayed it gives 0. I request to make me understand this in detail. thanks


2019-01-29 02:33:57

Iftikhar Ahmad

Sir, when I subtract 17951683 - 17952811 it shows the result 1128 rather to show the result 1129. How to resolve this issue.


2017-09-20 19:48:48

jolsef

Hello, what would you recommend if I needed to take the difference between two number (for example 123.7 and 123.15) and I needed to report the result to the tenths (one decimal place). However, I also need the same formula to also work for numbers with different decimal places (for example 123.07 and 123.015).

Take for example:

A B C
1 124.15 124.7 =B1-A1
2 124.015 124.015 =B2-A2

I don't have the luxury to change my formula every time a user enters a different number with different number of decimal places into any of A1:B2.


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.