-- in formula

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I noticed this formula in a recent post:

=SUMPRODUCT(--(C2:C6>0),--(F2:F6="QQQ"))

What does the -- signify?

Thanks
Alby
 
Alby said:
I noticed this formula in a recent post:

=SUMPRODUCT(--(C2:C6>0),--(F2:F6="QQQ"))

What does the -- signify?

Experiment. Put 1 in cell A1 and 0 in cell A2. Enter the formulas =A1=A1 in
B1 and =A1=A2 in B2. Now enter the formulas =-B1 in C1 and =-B2 in C2. Next,
enter =--B1 in D1 and =--B2 in C2. Finally, enter =SUM(B1:B2) in B3 and
=SUM(D1:D2) in D3.
 
Harlan

Do I replace =A1=A2 in B2 with =--B2
If so I'm struggling to understand what -- is doing to the formula

Sorry to be a pai

Alb

----- Harlan Grove wrote: ----

Alby said:
I noticed this formula in a recent post

Experiment. Put 1 in cell A1 and 0 in cell A2. Enter the formulas =A1=A1 i
B1 and =A1=A2 in B2. Now enter the formulas =-B1 in C1 and =-B2 in C2. Next
enter =--B1 in D1 and =--B2 in C2. Finally, enter =SUM(B1:B2) in B3 an
=SUM(D1:D2) in D3
 
Hi Alby!

-- "coerces" TRUE to 1 and FALSE to 0. Same as multiplying twice
by -1.

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
This will take you to a great many discussions on the unary (--) !

http://tinyurl.com/qvyp
--

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================



Harlan,

Do I replace =A1=A2 in B2 with =--B2?
If so I'm struggling to understand what -- is doing to the formula.

Sorry to be a pain

Alby

----- Harlan Grove wrote: -----

Alby said:
I noticed this formula in a recent post:

Experiment. Put 1 in cell A1 and 0 in cell A2. Enter the formulas
=A1=A1 in
B1 and =A1=A2 in B2. Now enter the formulas =-B1 in C1 and =-B2 in C2.
Next,
enter =--B1 in D1 and =--B2 in C2. Finally, enter =SUM(B1:B2) in B3 and
=SUM(D1:D2) in D3.
 
Back
Top