Strange Value Results in a Cell

Written by Allen Wyatt (last updated August 17, 2019)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


3

Lynn uses Excel to keep track of her checkbook. She has the cells in the worksheet formatted to show values like $1,234.56. Sometimes, but not always, if Lynn changes the formatting of a cell it may look like 1234.56000000001. This seems like an error to her and she finds it annoying, so she is wondering why the figures look this way at times.

Lynn has inadvertently discovered the strange, wonderful world of Excel math. You see, when you do math in an Excel formula, because of the way that Excel does the calculations internally, you could easily end up with a rounding error at the most extreme ends of the calculation. (Excel maintains internal precision to 15 significant digits, which is why Lynn is seeing the "error" out at the very furthest reaches of her number.)

In routine calculations—like the ones being done by Lynn—this typically isn't a problem. In her usage, she only cares about numbers being correct to a precision of two decimal places. When the "error" is in the eleventh decimal place, it isn't going to affect the validity of what Lynn sees. It would only affect the results if a particular result relied upon thousands and thousands and thousands of previous calculations. This is the only way that the "error" could compound to the point where it affects Lynn's results.

In day to day usage, this shouldn't be an issue. The "error" is hidden easily by using a cell format such as Currency or Accounting that displays values, so they show only two decimal places.

If the rounding issues bug you a lot, the easiest solution is to force your formulas to round to the number of decimal places you want. For instance, let's say you have a very simple formula such as the following:

=A1-B1

You could "wrap" the formula in the ROUND function, in this manner:

=ROUND(A1-B1,2)

This forces the result returned by Excel to two decimal places, which is what Lynn would expect to see if she removes the cell formatting.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13663) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365.

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 a List of Unique Words

Need to grab a list of unique words appearing in a document? You can tap the power of VBA's Words collection to perform ...

Discover More

Formatting Text in Custom Document Properties

Word allows you to create custom document properties that stay with a document and can be inserted through the use of ...

Discover More

Replacing Commas with Periods

Want to replace all commas in a formatted number with periods, and vice-versa? There are a couple of approaches you can ...

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 (ribbon)

Generating Random Door Access Codes

People often use Excel to maintain lists of information that they need to track. This tip shows several ways you can ...

Discover More

Finding the Nth Occurrence of a Character

The FIND and SEARCH functions are great for finding the initial occurrence of a character in a text string, but what if ...

Discover More

Checking for Either of Two Text Values

Using a formula to find information in a text value is easy. Using a formula to find either of two text values within a ...

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 two more than 7?

2019-08-17 21:34:27

MW

RH: Great tip!!

However when I applied it (unless I did something wrong) I immediately realized your instructions only reset this setting on the current Workbook you are working in; it is not a universal change.

In order to affect all of a user's new Excel files by default they must locate and make your recommended setting change in all of their template files (i.e. where they want this change to occur) and save them as their default template.

And as anybody unfamiliar with template files will find out, making a universal change in the default template file(s) can be a challenge.

So one should first search Allen's Excel Tips website for Template Changing instructions.


2019-08-17 08:54:17

Lynn Gates

Thanks for the rounding tip...I had stumble on the solution after I sent the email for help. I do appreciate you looking into it.

lg

PS 72+ years ago when I was born, my parents named me Lynn...a name that is shared with many females...however I was born a male and have been all my life. Interestingly enough in my high school class there was another male named Linn. Granted not a common name...but nicer than what I was called by some people I arrested while being a policeman.

lg


2019-08-17 05:20:22

RON HOWELL

Another fix is to click on the File tab, go down the left side menu and select options.
Select the Advanced option, scroll down to almost the bottom of the window and check "Set Precision As Displayed".
Click the ok button on the popup screen that states "Data will permanently lose accuracy". This will not adversely affect your calculations when you are only going out to less than 10 decimal points and as an added bonus it will eliminate the annoying negative zero.
The other benefit is that you will not have to use the round formula for each cell, it will automatically adjust all cells.


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.

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.