Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default What does using -- in a formula do?

I was helped yesterday with creating a complex formula using the SUMPRODUCT
function. It worked GREAT and I thank you VERY much. I mostly understand how
it works, but I did not understand the use of -- in it. Here is the formula:

=SUMPRODUCT(--(Dates!B$4:B$21=A13),--(B13=Dates!C$4:C$21),--(B13<=Dates!D$4:D$21),Dates!E$4:E$21)

Can you explain the formulas use of the "--"'s? Thanks!!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default What does using -- in a formula do?

Hi,

The 2 minus signs (double unary) covert TRUE and FALSE into 1 and 0

Mike

"SykesvilleJim" wrote:

I was helped yesterday with creating a complex formula using the SUMPRODUCT
function. It worked GREAT and I thank you VERY much. I mostly understand how
it works, but I did not understand the use of -- in it. Here is the formula:

=SUMPRODUCT(--(Dates!B$4:B$21=A13),--(B13=Dates!C$4:C$21),--(B13<=Dates!D$4:D$21),Dates!E$4:E$21)

Can you explain the formulas use of the "--"'s? Thanks!!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default What does using -- in a formula do?

Sorry,

I meant to supply a link giving the full explanation. Look here

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

Mike

"Mike H" wrote:

Hi,

The 2 minus signs (double unary) covert TRUE and FALSE into 1 and 0

Mike

"SykesvilleJim" wrote:

I was helped yesterday with creating a complex formula using the SUMPRODUCT
function. It worked GREAT and I thank you VERY much. I mostly understand how
it works, but I did not understand the use of -- in it. Here is the formula:

=SUMPRODUCT(--(Dates!B$4:B$21=A13),--(B13=Dates!C$4:C$21),--(B13<=Dates!D$4:D$21),Dates!E$4:E$21)

Can you explain the formulas use of the "--"'s? Thanks!!

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default What does using -- in a formula do?

Please refer

http://www.mcgimpsey.com/excel/formulae/doubleneg.html
--
If this post helps click Yes
---------------
Jacob Skaria


"SykesvilleJim" wrote:

I was helped yesterday with creating a complex formula using the SUMPRODUCT
function. It worked GREAT and I thank you VERY much. I mostly understand how
it works, but I did not understand the use of -- in it. Here is the formula:

=SUMPRODUCT(--(Dates!B$4:B$21=A13),--(B13=Dates!C$4:C$21),--(B13<=Dates!D$4:D$21),Dates!E$4:E$21)

Can you explain the formulas use of the "--"'s? Thanks!!

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default What does using -- in a formula do?

And perhaps to just explain fully what the below formula is saying...

=SUMPRODUCT(--(Dates!B$4:B$21=A13),--(B13=Dates!C$4:C$21),--(B13<=Dates!D$4:D$21),Dates!E$4:E$21)

Means..

For each row of sheet named Dates from 4 - 21 whe

column B equals cell A13 of our sheet
AND
column C is less than or equal to B13 of our sheet
AND
column D is greater than or equal to B13 of our sheet

sum the values in column E

The calculation gives 1 to each that meet the criteria when -- is present.
SUMPRODUCT multiplies all of the arrays together for each row, then adds the
rows together.
Since 0 times any number is 0, having a 0 in any of the arrays returns for
that row
since 1 times any number is itself, any row that meets all criteria will be
1*1*1*calue in column D.

Then, every row is added together... all your 0's, then all your resulting
D's...

Hope that was broken down enough. :-)

"Mike H" wrote:

Sorry,

I meant to supply a link giving the full explanation. Look here

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

Mike

"Mike H" wrote:

Hi,

The 2 minus signs (double unary) covert TRUE and FALSE into 1 and 0

Mike

"SykesvilleJim" wrote:

I was helped yesterday with creating a complex formula using the SUMPRODUCT
function. It worked GREAT and I thank you VERY much. I mostly understand how
it works, but I did not understand the use of -- in it. Here is the formula:

=SUMPRODUCT(--(Dates!B$4:B$21=A13),--(B13=Dates!C$4:C$21),--(B13<=Dates!D$4:D$21),Dates!E$4:E$21)

Can you explain the formulas use of the "--"'s? Thanks!!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"