Calculation doesnt show exact result

el_ja

Board Regular
Joined
Nov 5, 2007
Messages
80
Hello
This is something that has happened to me some times but never understood why.
I'm doing a simple calculation which I can easily do in my head, and the answer should be 0 but excel returns a negative 0.
Upon further inspection the 14th decimal position has a value, but it should be 0.
Anyone knows how to correct this? (tried it in 2 computers with the same result)
1234
A7212.504141.252907.01164.24+A1-A2-A3-A4

<tbody>
</tbody>
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Your computer uses a binary floating point representation of numbers that can't store most decimals exactly, just as finite decimals can't store 1/3 exactly. Use ROUND().
 
Upvote 0
I can live with the negative 0, just wanted to know if perhaps there was a setting to correct it.
Thanks a lot to both of you
 
Upvote 0
I can live with the negative 0, just wanted to know if perhaps there was a setting to correct it.

First, it is not "negative zero". It only appears that way due to your cell formatting choice. It is important to understand that A5=0 is FALSE (!).

Second, there is a setting that might "correct" the calculation.

But I do not recommend it. If you choose to experiment, be sure to save a copy of your Excel file first. Just enabling the option can change some constants irreversibly, potentially changing the behavior of your entire workbook unintentionally.

The option is called "Precision as displayed" (PAD). On my version of Excel, I would click File > Options > Advanced, and scroll down to the lower half of the list.

Before you set the option (and after you save a copy of your file), you might want to review the format of every cell. Setting PAD is useful only when you use numeric options with a limited number of decimal places.

Note that PAD will only "correct" such calculation anomalies in the final cell value. For example, the formula =A1-A2-A3-A4 will result in exactly zero if it is formatted with 2 decimal places. But the expression A1-A2-A3-A4=0 still returns FALSE. That might cause inconsistencies in the behavior of your workbook.

Instead of setting PAD, I prefer and recommend that you explicitly round any calculation that you expect to be accurate to some number of decimal places. And round to that number of decimal places, not some arbitrary number (some suggest 10). The latter will not always work. Of course, you must make a prudent choice about when to round a calculation. That is why I say: "when you expect [it] to be accurate".
 
Last edited:
Upvote 0
The link I provided does explain the PAD option but I totally agree with joeu2004 it is not an option I would use.
 
Upvote 0
That's a very thorough and nice explanation joeu2004.
I Definetly don't need to enable PAD, I'm working with money so a 0,00 result is more than enough (even if it looks red due to formatting)
I was mostly curious and you guys have answered my question completely
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,178
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top