What is the "--" (double dash) in MS Excel formula?

A

Alfred

I would like to know the meaning of "--" (double dash) in the below Excel formula:

========= start of formula =================
=SUM(OFFSET(Source!$C$4:$C$425,,,MATCH(0,--(MMULT(--(ROW(OFFSET($A$1,,,ROWS(Source!$C$4:$C$425)))>=COLUMN(OFFSET($A$1,,,,ROWS(Source!$C$4:$C$425))))-0.5*(ROW(OFFSET($A$1,,,ROWS(Source!$C$4:$C$425)))=COLUMN(OFFSET($A$1,,,,ROWS(Source!$C$4:$C$425)))),OFFSET(Source!$C$4:$C$425,,,ROWS(Source!$C$4:$C$425))+0)>SUM(Source!$C$4:$C$425)*ROWS($C$4:$C5)/4))))-SUM(OFFSET(Source!$C$4:$C$425,,,MATCH(0,--(MMULT(--(ROW(OFFSET($A$1,,,ROWS(Source!$C$4:$C$425)))>=COLUMN(OFFSET($A$1,,,,ROWS(Source!$C$4:$C$425))))-0.5*(ROW(OFFSET($A$1,,,ROWS(Source!$C$4:$C$425)))=COLUMN(OFFSET($A$1,,,,ROWS(Source!$C$4:$C$425)))),OFFSET(Source!$C$4:$C$425,,,ROWS(Source!$C$4:$C$425))+0)>SUM(Source!$C$4:$C$425)*ROWS($C$4:$C4)/4))))
========= end of formula =================

Thanks.
 
J

joeu2004

Alfred said:
I would like to know the meaning of "--" (double dash)
in the below Excel formula: [....]
MATCH(0,--(MMULT(--(ROW(OFFSET(....
MATCH(0,--(MMULT(--(ROW(OFFSET(....

It is simply double-negation. As you might know, -5 is negative 5. --5 is
negative negative 5, which is simply 5.

Normally, double-negation is needed to convert non-numeric values to numeric
values. Any idempotent arithmetic operation will work; for example,
multiplying by 1 instead of using double-negation. (But I prefer
double-negation.)

I have not completely parsed the formula that you provided. But my guess
is, the double-negative is used in the following context:

--(something=something)

In that context, we are converting the (array of?) logical value(s) TRUE and
FALSE to 1 and 0, which might be needed for the MATCH expression to work
properly.
 
S

Stan Brown

Normally, double-negation is needed to convert non-numeric values to numeric
values. Any idempotent arithmetic operation will work; for example,
multiplying by 1 instead of using double-negation. (But I prefer
double-negation.)

Out of curiosity, why? How is that superior to multiplying by 1 or
adding 0?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top