Just a question regarding a formula operator.
The unary minus (-) operator negates values (positive to negative,
negative to positive). Using two in a row restores the sign.
As with any math operator, XL tries to coerce operands to numeric
form if it can. With TRUE/FALSE, XL coerces them to 1/0,
respectively, so
--TRUE == --(1) == -(-1) == 1
--FALSE == --(0) == -(-0) == 0
You could accomplish the same thing with
TRUE + 0 == (1) + 0 == 1
but double unary minus seems to be a bit faster and has a higher
precedence.
In article ,
"Todd S" wrote:
I've recently been introduced to the following formula
through Newsgroups:
=SUMPRODUCT(--(Sheet1!$B$2:$B$9000=1),--(Sheet1!
$C$2:$C$9000=14))
It works for my needs, however, I'm trying to understand
it for other applications.
What do the -- operators do? I've never seen them before
and can't find a reference.
|