ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Formula question (https://www.excelbanter.com/excel-discussion-misc-queries/224142-formula-question.html)

NWO

Formula question
 
Can somebody please explain what the puprose is of the -- in the following
formula?

=SUMPRODUCT(--(ISNUMBER(C5:C61)),--(MONTH(C5:C61)=2))

Thank you.

Mark

Elkar

Formula question
 
Basically, the easy answer is that -- is the same as multiplying the result
by -1 twice. So why do this?

ISNUMBER(C5) returns either TRUE or FALSE. Neither of which are usable by
SUMPRODUCT. SUMPRODUCT needs numbers. Excel does equate FALSE to 0 and TRUE
to 1. So, by multiplying TRUE or FALSE by -1 twice you get:

0 x -1 x -1 = 0
1 x -1 x -1 = 1

You now have either a 0 or a 1 that SUMPRODUCT can work with.

HTH
Elkar


"NWO" wrote:

Can somebody please explain what the puprose is of the -- in the following
formula?

=SUMPRODUCT(--(ISNUMBER(C5:C61)),--(MONTH(C5:C61)=2))

Thank you.

Mark


RagDyeR

Formula question
 
http://www.mcgimpsey.com/excel/formulae/doubleneg.html

http://www.xldynamic.com/source/xld.SUMPRODUCT.html



--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"NWO" wrote in message
...
Can somebody please explain what the puprose is of the -- in the following
formula?

=SUMPRODUCT(--(ISNUMBER(C5:C61)),--(MONTH(C5:C61)=2))

Thank you.

Mark




NWO

Formula question
 
Thank you very much for the explanation.

Mark :)

"Elkar" wrote:

Basically, the easy answer is that -- is the same as multiplying the result
by -1 twice. So why do this?

ISNUMBER(C5) returns either TRUE or FALSE. Neither of which are usable by
SUMPRODUCT. SUMPRODUCT needs numbers. Excel does equate FALSE to 0 and TRUE
to 1. So, by multiplying TRUE or FALSE by -1 twice you get:

0 x -1 x -1 = 0
1 x -1 x -1 = 1

You now have either a 0 or a 1 that SUMPRODUCT can work with.

HTH
Elkar


"NWO" wrote:

Can somebody please explain what the puprose is of the -- in the following
formula?

=SUMPRODUCT(--(ISNUMBER(C5:C61)),--(MONTH(C5:C61)=2))

Thank you.

Mark



All times are GMT +1. The time now is 07:40 AM.

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