ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Meaning of "--" in formulas (https://www.excelbanter.com/new-users-excel/181240-meaning-formulas.html)

JoAnn

Meaning of "--" in formulas
 
I sometimes see formulas with -- before a set of parenthesis (sample formula
below), can anyone tell me what the purpose of it is? I can't seem to find
it documented anywhere.

For example:
=SUMPRODUCT(--(MONTH(b7:b400)=MONTH(D417)), --(YEAR(b7:b400)=YEAR(D417))

Thanks
--
JoAnn

Cimjet[_2_]

Meaning of "--" in formulas
 
Hi JoAnn

The -- stuff changes trues and falses
to 1's and 0's. Logic expression to numeric expression.
Regards
Cimjet

"JoAnn" wrote in message
...
I sometimes see formulas with -- before a set of parenthesis (sample
formula
below), can anyone tell me what the purpose of it is? I can't seem to
find
it documented anywhere.

For example:
=SUMPRODUCT(--(MONTH(b7:b400)=MONTH(D417)), --(YEAR(b7:b400)=YEAR(D417))

Thanks
--
JoAnn



JoAnn

Meaning of "--" in formulas
 
Great! Thanks.
--
JoAnn


"Cimjet" wrote:

Hi JoAnn

The -- stuff changes trues and falses
to 1's and 0's. Logic expression to numeric expression.
Regards
Cimjet

"JoAnn" wrote in message
...
I sometimes see formulas with -- before a set of parenthesis (sample
formula
below), can anyone tell me what the purpose of it is? I can't seem to
find
it documented anywhere.

For example:
=SUMPRODUCT(--(MONTH(b7:b400)=MONTH(D417)), --(YEAR(b7:b400)=YEAR(D417))

Thanks
--
JoAnn




Michael M

Meaning of "--" in formulas
 
Hi JoAnn
Further to Cimjets answer.
The -- is called a Double Unary and the simple way to see Cimjets answer is
to take them out of the formula and see the result in the formula bar.
It will refer to True or false rather than a mathematical result

Regards
Michael M

"JoAnn" wrote:

Great! Thanks.
--
JoAnn


"Cimjet" wrote:

Hi JoAnn

The -- stuff changes trues and falses
to 1's and 0's. Logic expression to numeric expression.
Regards
Cimjet

"JoAnn" wrote in message
...
I sometimes see formulas with -- before a set of parenthesis (sample
formula
below), can anyone tell me what the purpose of it is? I can't seem to
find
it documented anywhere.

For example:
=SUMPRODUCT(--(MONTH(b7:b400)=MONTH(D417)), --(YEAR(b7:b400)=YEAR(D417))

Thanks
--
JoAnn





All times are GMT +1. The time now is 12:09 PM.

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