Bruno Campanini said:
The real point for me is that I can't avoid to call
"stupid" who writes such stupid things
Fine. Then you won't mind my comments below. "People who live in glass
houses ...".
[EDIT] Okay, I cleaned them up. I should stoop to your level.
Bruno Campanini said:
If I39 contains Null string or any other text, I39>0 returns
False or 0 in the very same way SUM(I39)>0 does. [....]
Why don't you try the things before commenting?
ROTFL! Right back at you!
When someone tells you something, you are obliged to try it or ask for help
before repeating your own misunderstandings.
You probably don't even know what a null string is. One way to write it is
="". Of course, the more common situation is an IF expression like the one
we wrote here. In any case, the point is: the null string is not the same
as an empty cell (a cell with no constant and no formula).
Put ="" into I39. Then try =IF(I39>0,(I39*I40)+I39,"").
If you don't get a #VALUE error, you are making another mistake, which would
not surprise me at all.
The #VALUE error occurs because you are calculating ""*I40+"". Generally,
we cannot use text in arithmetic expressions, unless Excel recognizes the
text as something it can convert to a number (numeric strings, dates,
percentages, etc). Sadly, Excel does not recognize the null string as an
"empty number". (I think it should.)
Then if you have Excel 2003 or 2007, you can RTFM: find the help page for
"default sort order". It will tell you that all text is consider "greater
than" all numbers. That is why "">0 is TRUE.
(AFAIK, there is no option to alter that behavior. But if there is and you
set it, please let me what it is.)
Now try =IF(SUM(I39)>0,(I39*I40)+I39,""), or as I prefer:
=IF(N(I39)>0,(I39*I40)+I39,""). The result should be the null string.
Explanation.... With SUM(I39) and N(39), the result is zero because SUM
ignores text and N returns zero, even text that Excel might otherwise
recognize as a number.
PS: I wrote previous that the N function help page is hard to find. That
was the case with Excel 2003. Surprisingly, it is straight-forward to find
with Excel 2010, as well as with Excel 2007. I say "surprisingly" because
Excel 2010 help search is mostly broken, IMHO. I usually have to revert to
Excel 2003 or 2007 to find help pages.
Bruno Campanini said:
If you really need to avoid any ambiguity - but now it
is not the case - use the Unary Operator (--I39).
That will have the same problem: it will return a #VALUE error if I39 is
the null string (or any text that Excel does not recognize as a number).
And for the same reason, to wit: we cannot use (non-numeric) text in
arithmetic expression. FYI, the double negative is an arithmetic
expression.