Formula =(N59 -O59 - P59 - R59)
working fine for most rows but for some rows, the sum is 0 - but it is showing a strange value like -7.27596E-12
I have tried many thing but I don't know what I am missing
Because computer math isn't exact in decimal, so 0.1+0.9 is not necessarily exactly 1.0. The notation "E-12" means "times ten to the minus twelfth," which is tiny.
Here's a forum thread on the subject, and here's the official Office documentation. If you change the cell format from General to Number, you can set how many digits you want. E.g., if you select 2 digits, 0.001 or anything smaller will round down to display as 0.
Related
I have a suspicion Excel is calculating exponents that are repeating decimals represented as a fraction (e.g. 1/3) differently than ones that don't have repeating decimals (e.g. 1/2). It is preventing me for a formula that finds perfect cubes in a list of numbers.
Column A lists numbers 1 to 100.
Column B has the following formula (starting with row 5):
=IF($A5^(1/2)-ROUND($A5^(1/2),0)=0,1,0)
This should return "1" if the number in column A is a perfect square, like 1, 4, 9, etc. and does so correctly. This other formula I originally wrote also works: =IF(SQRT($A8)-ROUND(SQRT($A8),0)=0,1,0).
Column C has the following formula (starting with row 5):
=IF($A5^(1/3)-ROUND($A5^(1/3),0)=0,1,0)
Note that it is the exact same as the perfect square identifying formula, except there is a 3 where there was a 2. This is not returning a "1" for perfect cubes like 8, 27, 64. etc. (but does return a "1" for the number 1).
Can anyone help me correct this?
I apologize for not knowing how to pick a comment as an answer, so I aggregated the helpful comments and am posting them as an answer.
Main Explanation:
See Floating-point arithmetic may give inaccurate results in Excel. If you examine the underlying xml, you will see that Excel is calculating A1^(1/3) as 1.9999999999999998. The article explains why, and suggests some work arounds. – Ron Rosenfeld
Workaround I picked:
Can't you replace $A5^(1/3)-ROUND($A5^(1/3) with $A5 - ROUND($A5^(1/3))^3? – r3mainer
Thanks all!
I have a column of positive and negative numbers, which when summed should balance to zero (it's an accounting sheet).
However, if I use a SUMIF formula, instead of 0, i get:
1.81899E-12 or -9.09495E-13 or similar. (I don't know what this sort of result is called, but I think they represent very large or very small numbers)
I have created a sample document which shows the issue.
It returns a zero if the cell is formatted as a number, but the above result if formatted as general.
I often also find that even the simple SUM function also returns a similar result, as does the SUM in the status bar at the bottom of excel, so it is not just the SUMIF function I am struggling with. However, I have been unable to recreate the issue with the SUM function in my example spreadsheet.
I'm using Excel as part of Home and Business 2013.
Thanks for your help.
As #Dominique pointed out, xxxE-12 is a very, very small number. It is very, very close to zero.
xxxE-12 is Excel's (and most programming languages') way of writing xxx * 10^-12.
As you guessed, this is due to rounding. It however also displays the issues of how computers handles floating-point (decimal) numbers; what you think is 1 / 3 = 0.333 might be represented internally as something like 0.333333681. See https://en.wikipedia.org/wiki/Floating-point_arithmetic, or notably https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems.
Secondly, why this appears if the cell is formatted as "General", but not "Number"? With "Number", you expect an integer part and at most, say, 3 decimals. x.xxE-12 has the largest non-zero component at the 12th (!) decimal. So when displayed, it gets rounded to a nice zero. "General" however attempts to display the number as close to the actual value, which in this case is the xxxE-12.
Also note that this might give you issues if you try to compare your calculated value with zero. Say, =IF(SUMIF(...) = 0, ...; it might not evaluate to TRUE even when you think it does (due to the very small value). The solution is instead to compare the difference of calculated value to zero: =IF(ABS(SUMIF(...) - 0) < 1E-9, ....
I am trying to use Microsoft Excel to format a large set of data. The data is all in decimal format and the results are paired so that we have 2 values per record. The first value is a Mass in grams, and the second value is the Uncertainty of that mass also in grams.
For example:
SampleName = S1, Mass(g) = 28.695, Uncertainty(g) = 1.601133
What I need to do is have the "Uncertainty" update to 2 significant figures, then depending on the value returned, have the "Mass" update to match the number of decimal places (or whole numbers) that the "Uncertainty" now is.
e.g.
if Uncertainty became 1.6, then Mass should become 28.6
if Uncertainty became 1.61, then Mass should become 28.69
if Uncertainty became 2, then Mass should become 29
I have attempted to use the ROUND function on the "Uncertainty" cell but then I don't know how to make the "Mass" cell update accordingly.
I have tried the following 2 ROUND formulas, which both seem to work for rounding the "Uncertainty":
=ROUND(A1,2-INT(LOG(ABS(A1))))
=ROUND(A1, 2)
Any help would be much appreciated.
This formula counts the number of decimal places in a given cell:
=LEN(RIGHT(A1,LEN(A1)-FIND(".",A1)))
So you could use this in your Round formula where you specify the number of decimals:
=ROUND(A1, LEN(RIGHT(A1,LEN(A1)-FIND(".",A1))))
To round to 2 significant figures you can use something like this:
=ROUND(uncertainty,2-(1+INT(LOG10(ABS(number)))))
To round (eg) B2 based on number of decimals in (eg) D2:
=ROUND(B2,IFERROR(LEN(RIGHT(D2,LEN(D2)-FIND(".",D2))),0))
I am very new to Excel and I have a problem with a simple multiplication (I know, it is depressing but I'm stuck).
I have to multiply the numeric content of 2 cells (these value are calculated using 2 different formulas).
The problem is that it seems that these 2 cells contain numeric values having different format and I obtain a strange result.
Infact I have:
1) The K3 cell containing this value: 0,0783272400
2) The K6 cell containing this value: 728.454911165
In another cell I simply do:
=K3*K6
but now I am obtaining this nonsense value: 57.057.862.655,9996000000
I think that the problem could be related to the fact that the first one use the , do divide integer section and decimal section, and in the other one I am using . to divider the integer section and decimal section.
How can I correctly handle this situation?
Format both values as Currency in Excel and forget about the issue.
You are getting it, because the floating point values are not represented differently in many programming languages. In Excel probably the best way to make sure you do not give strange values is to format as Currency.
Or in VBA to use the CDec and to convert to decimal.
Is floating point math broken?
Excel is treating 0,0783272400 as something less than one tenth and 728.454911165 as getting on for one thousand billion. The result is formatted with . for thousands separator and , for decimal separator - and is not nonsensical (though the choice of formatting is).
I have a large excel file the contains many way-points in Latitude and Longitude in the degree and minutes. My problem is that the numbers can't be rounded and must stay exactly the same, but the last 2 numbers need to be removed (in most cases)
I was wondering if there is a formula that would only allow three characters past the decimal. This is how most my numbers look.
26° 17.82964
However Sometimes they look like this
26° 9.82
I know I can format the cell as a number and set the decimal place to 3, however when I copy and paste it doesn't stay the same.
This formula will truncate (It does not Round) the numbers and give all if less:
=MID(A1,1,FIND(".",A1)+3)
This formula will round, but it will always fill out the numbers to three decimal places (I am aware the OP did not want rounding, this is for others that may want it.):
=LEFT(A1,FIND(" ",A1))&TEXT(ROUND(--MID(A1,FIND(" ",A1),LEN(A1)),3),"0.000")