A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

What does using -- in a formula do?



 
 
Thread Tools Display Modes
  #1  
Old May 15th, 2009, 01:28 PM posted to microsoft.public.excel.misc
SykesvilleJim
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$21),Dates!E$4:E$21)

Can you explain the formulas use of the "--"'s? Thanks!!
  #2  
Old May 15th, 2009, 01:38 PM posted to microsoft.public.excel.misc
Mike H
external usenet poster
 
Posts: 8,419
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$21),Dates!E$4:E$21)

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

  #3  
Old May 15th, 2009, 01:40 PM posted to microsoft.public.excel.misc
Mike H
external usenet poster
 
Posts: 8,419
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$21),Dates!E$4:E$21)

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

  #4  
Old May 15th, 2009, 01:42 PM posted to microsoft.public.excel.misc
Jacob Skaria
external usenet poster
 
Posts: 5,952
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$21),Dates!E$4:E$21)

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

  #5  
Old May 15th, 2009, 06:06 PM posted to microsoft.public.excel.misc
Sean Timmons
external usenet poster
 
Posts: 1,722
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$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$21),Dates!E$4:E$21)

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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


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