atin said:
can you explain the logic of formula.
Referring to your link to
http://spreadsheets.google.com/ccc?key=rJzjkLwANDZqnlQHllepUYQ in another
posting in this thread....
You seem to be wondering why in L54, for example, 2.3+2.25-4.45 appears to
be 0.1, but IF(L54=0.1,L54,"") returns a null string instead of 0.1 (L54).
If you format L54 as Number with 16 decimal places and you format a cell
with the constant 0.1 formatted Number as 16 decimal places, you will see
the reason: L54 is really about 0.0999999999999996, whereas 0.1 is really
about 0.1000000000000000.
(Note: Technically, it does not make sense to format the constant 0.1 with
16 decimal places, since Excel will only format the first 15 significant
digits and fill in the rest with zero. But it makes that comparison with
L54 easier to see and explain.)
I explained the reason in one of my previous postings in this thread, to
wit: "results of even simple arithmetic [do] not always exactly
match the displayed number".
If you format L54 as General or as Number with 1 or 2 decimal places, Excel
will automatically round the __displayed__ value to 0.1. The operative word
is "displayed". Obviously, the underlying value is not really 0.1, since we
can format it to 16 decimal places and see a different value.
Moreover, the difference between the true value in L54 and the constant 0.1
is large enough that Excel considers them to be different. Sometimes Excel
treats different values as equal when they are "close". See the section
"Example When a Value Reaches Zero" in
http://support.microsoft.com/kb/78113. The explanation there is not
entirely accurate. But it might give you some idea about what is going on.
By explicitly rounding L54 to 2 decimal places (or 1 decimal place), you are
forcing the value used in the comparison to be exactly the same as the
constant with that number of decimal places. In other words, when
0999999999999996 is rounded to 2 dp, its result (0.10) exactly matches the
constant 0.10.
Now, you might wonder why 2.3+2.25-4.45 is not exactly the same the constant
0.1. The answer is complicated, and I am not sure you would understand.
The aforementioned link to KB 78113 might give you some insight.
Alternatively, if you what the technical details, post a reply here, and I
will gladly offer what I think is a better explanation.
HTH.
----- original message -----