Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Errors When Subtracting.

# Errors When Subtracting

by Allen Wyatt
(last updated February 1, 2020)

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/?kbid=78113
```

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 within all formulas by following these steps:

1. Display the Excel Options dialog box. (In Excel 2007 click the Office button and then click Excel Options. In Excel 2010 or a later version, display the File tab of the ribbon and then click Options.)
2. At the left of the dialog box click Advanced.
3. Scroll through the available options until you get to the section entitled "When Calculating this Workbook." (See Figure 1.)
4. Figure 1. The Advanced options in the Excel Options dialog box.

5. Ensure that the Set Precision As Displayed check box is selected.
6. 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 (6176) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel 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

Deriving an Absolute Value in a Macro

Need to figure out an absolute value within your macro code? It's easy to do using the Abs function, described in this tip.

Discover More

Updating Fields in Locked Forms

Updating form fields in Word can be confusing, especially when the fields are locked in a form. This tips explains why ...

Discover More

Two Printed Copies to Different Paper Trays

Many modern printers include multiple paper trays that can be used for different types or colors of paper. Word allows ...

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!

##### Subscribe

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

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}] 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 9 + 6?

2019-12-02 09:15:26

Peter Atherton

Ray
I was surprised that you used the IMSUB function as this is for imaginary numbers. The IM gives the clue. I copied your numbers & tried the following

=G7-H7 = 33318.75
=IMSUB(G7,H7) = 33318.75
=IMSUB(G7,H7)/1 = 33318.75
=IMSUB(G7,H7) *1 = 33318.75

With the last two formulas I had to alter the decimal places. This suggests that the original values are from formulas that should have been rounded to 2 decimals. I suggest wrapping both formulas in the round function
{[fig}]

John
That was a really interesting post but I guess the reason that is is not done is given in the last paragraph and people use the KISS principle when possible.

2019-12-01 17:01:17

John Mann

By way of a point of interest, while it's true that computers genreally convert all numbeers to pure binary for their internal purposes, the convert them back to decimal (or Hex or Octal) for display purposes, it's not necessarily true in the world of digiital electronics. Back in the dim and distant past when I was an electronic technician, we aften had digital circuitry which worked with what we called BCD - binary coded decimal. By way of example a 4-bit counter could either be binary or BCD - the binary ccounter generated an overflow (carry out) at the binary number1111 (deicmal 15) while the BCD counter gernrated it's carray out (Overflow) at the binary count of 1001 (decimal 9). This type of circuitry was extremely usefull if the result had to b e displayed visually, such as, for example a frequency counter or voltmeter.

There is no reason, in principal, that I know of, why a computer could not be constructed which would work with BCD and do all it's maths using BCD. It wold not be the most efficient use of resources, however, and would require that things like alphabet enxoding be done completely differently to how they are done, and would end up using more memory with quite a bit of wasted space.

2018-11-29 13:46:03

Ray Porter

I am an absolute amateur with regards to Excel, however I have experienced this problem continually when subtracting one column of numbers from another (i.e. Business Banking, debits from credits running total) I had tried many suggested methods to no avail. YESTERDAY SUCCESS!!!!
I will assume you have already formatted the answer cell to 2 decimal points. Just add /1 (i.e. divide by one) to your formula and HEY PRESTO correct answer to 2 decimal points. Hope this helps
Actual example:
1042607.04 Debits 1075925.79 Credits Produces 33318.7500000013 Using formula =IMSUB(E3534,D3534)
1042607.04 Debits 1075925.79 Credits Produces 33318.75 Using formula =IMSUB(E3534,D3534)/1

2017-07-04 17:13:17

Andrea

This solution is valid also for Excel 2016

2015-09-11 14:11:10

Richard W

I have been using Excel for a couple of decades now and had never run into a problem with this until now. Thank you for providing the solution.

##### This Site

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