Sumproduct Fucntion - the use of dash ( -- )
Ron Coderre wrote:
In this formula: =SUMPRODUCT(--(A1:A10="Open"))
this section: (A1:A10="Open")
returns a series of TRUE/FALSE values
...which are not numeric to Excel.
When an arithmetic operator (+,-,*,/) is applied to
a TRUE/FALSE value, Excel converts TRUE to 1 and FALSE to 0.
The standard convention is to use
the Double-Minus (--) to convert the values.
It works this way:
TRUE=TRUE
-TRUE = -1
--TRUE = 1
FALSE = FALSE
-FALSE = 0
--FALSE = 0
You could also use 1*TRUE, but the Dbl-Minus indicates to
knowledgable users that you are forcing a conversion and not
trying to calculate something.
So, in the formula, the TRUE/FALSE values
are converted to 1's and 0's by the "--" and
SUMPRODUCT calculates the result.
Does that help?
--------------------------
Regards,
Ron
Microsoft MVP (Excel)
(XL2003, Win XP)
"Negda" wrote in message
...
In some example I saw the use of double dashes at the beginning:
=sumproduct( -- (....))
What does it mean? when I should use it and to avoid?
I've been trying to sum multiple columns where a condition does not
exeist in one of the columns. Example: columns x, y & z where z doesn't
contain "this condition".
I can understand that these work:
=SUMPRODUCT((condition1)*(condition2)*(condition3) )
and even =SUMPRODUCT(--(condition1),--(condition2),--(condition3))
but I can't understand how to get to my desired results. Would I write
the formula like this?
=SUMPRODUCT((condition1)*(condition2)-(condition3))
=SUMPRODUCT(--(condition1),--(condition2),-(condition3))
TIA
|