Thread: Double Dash
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Double Dash

"Erin Searfoss" wrote:
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))