usage of (--) or (-)

vinod9111

Active Member
Joined
Jan 21, 2009
Messages
426
Hi all,

i have seen lot of formula especially sumproduct where "--" or "-" is used. i understand it is used for giving the conditions when the column has text or dates to be retrieved. But what decides two minus or single minus or no minus to be used.

If somebody can throw some light on this will be really helpful for my excel
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
The use of -- in SUMPRODUCT formulas has nothing to do with text or dates. It is used to coerce the returned TRUE/FALSE values from the conditions into 1 and 0 respectively. (Ordinarily I would point you to this page for more details, but it seems that it's too popular and has exceeded the bandwidth cap for the month (again! :))
 
Upvote 0
In Excel worksheets we have a few different data types including:
  • Number
  • Text
  • Logical
  • Error

Sometimes you will see these data types referred to using slightly different terms, for example Logical data types can also be referred to as Boolean data types.

Some functions can only successfully process certain data types. This is determined by how the function is registered. In the case of SUMPRODUCT(), it works really well with Numbers, but it's not too hot on Logicals.

The examples you will have seen with the -- will most probably be when some Logicals are being coerced into Numbers so that SUMPRODUCT() can process them.

If the link Rory gave you to Bob's site isn't working soon let me know and I will give you some links to other similar material. You can also search the forum for terms such as "negation", "coercion" and "double unary minus" and you should get some useful hits.

Hope that helps...
 
Upvote 0
Thanx Rorya and colin for your reply.

Colin not able to open the page request your help with other links
 
Upvote 0
i do not really understand why -- is preferred to the *
as the above mentioned page points out (which is down right now), * is superior to -- because it can process conditions in horizontal alignment on which the unary operation fails imho
 
Upvote 0
Thanx Rorya and colin for your reply.

Colin not able to open the page request your help with other links

Okay, that page still appears to be down. You can try this link. It explains a bit about negation in #5 and at the end in #12 it has a links section to other array formula tutorials.
 
Upvote 0
Just as a very quick & dirty example:

Excel Workbook
ABCDEFGH
1* method-- method
2Field 1Field 2Field 3Criteria 1a#VALUE!10
3ax10Criteria 2x
4bza
5cx20
6axt
7by0
8dys
Sheet1


The * method here fails as it tries to multiply by a text value in the final column, the double unary method will account for only numerical values.

The * method has advantages over unary where dimensions are not of a consistent size ...

P.S. Don't get Colin started on single vs double unary operators :devilish:

Re: the efficiencies etc... the links provided should provide ample info :)
 
Upvote 0
The * method has advantages over unary where dimensions are not of a consistent size ...

Hi Luke, nice example, I see that there is a clear error-trapping difference between the 2 types of SUMPRODUCT methods.

I don't quite understand what you meant by your quoute though, could you please calrify with another example?
 
Upvote 0

Forum statistics

Threads
1,216,045
Messages
6,128,486
Members
449,455
Latest member
jesski

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top