Double Dash

  • Thread starter Thread starter Erin Searfoss
  • Start date Start date
E

Erin Searfoss

What does the double dash signify in a formula like this one I found in a
2006 post?

=SUMPRODUCT(--(X2:X500="foo"),--(Y2:Y500<100))

I've seen it muliple times and haven't quite figured it out. Thanks.
 
Erin Searfoss said:
What does the double dash signify in a formula like this one I found in a
2006 post?

=SUMPRODUCT(--(X2:X500="foo"),--(Y2:Y500<100))

Nothing special. It is simply an innocuous arithmetic operation (double
negation) that leaves the numeric result unchanged. For example, --5
= -(-5) = 5.

Some arithmetic operation is needed in order to treat the boolean result
(TRUE or FALSE) as a number (1 or 0) because SUMPRODUCT requires the latter.

But any valid arithmetic operation will have the same conversion effect.
For example, the above formula can be rewritten without "--" as:

=SUMPRODUCT((X2:X500="foo")*(Y2:Y500<100))
 
Back
Top