ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   What is the "--" (double dash) in MS Excel formula? (https://www.excelbanter.com/excel-worksheet-functions/449095-what-double-dash-ms-excel-formula.html)

Alfred[_5_]

What is the "--" (double dash) in MS Excel formula?
 
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)))=COL UMN(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$42 5))+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)))=COL UMN(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$42 5))+0)SUM(Source!$C$4:$C$425)*ROWS($C$4:$C4)/4))))
========= end of formula =================

Thanks.

joeu2004[_2_]

What is the "--" (double dash) in MS Excel formula?
 
"Alfred" wrote:
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.


Stan Brown

What is the "--" (double dash) in MS Excel formula?
 
On Sun, 4 Aug 2013 15:34:35 -0700, joeu2004 wrote:
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?

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com
Shikata ga nai...


All times are GMT +1. The time now is 03:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com