Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SheriTingle
 
Posts: n/a
Default What is the -- in formulas?

Hello and thanks for the help. I have seen -- in formulas and I have no idea
what that means or why the use of a double negative sign. Could someone
please explain to me when this is used and why?

Here's an example of a formula I saw using the --

=SUMPRODUCT(--($A$2:$A$30<""),--(TEXT($A$2:$A$30,"dddd")=$C2),--($B$2:$B$30))

THANKS!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Paul B
 
Posts: n/a
Default What is the -- in formulas?

Sheri, here is an answer from a previous post on the subject form Chip
Pearson

One uses the double negation operators -- to change a boolean
value of TRUE or FALSE to its numeric equivalent of 1 or 0. The
first - changes TRUE to -1 and FALSE to 0, and the second change
the -1 to +1 and the 0 to 0. The sign is always preserved because
the negative of a negative is the same number.


The -- is the same as multiplying what follows by -1 twice. It
is used to change comparisons which return TRUE or FALSE to their
numeric equivalents of 1 and 0.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"SheriTingle" wrote in message
...
Hello and thanks for the help. I have seen -- in formulas and I have no

idea
what that means or why the use of a double negative sign. Could someone
please explain to me when this is used and why?

Here's an example of a formula I saw using the --


=SUMPRODUCT(--($A$2:$A$30<""),--(TEXT($A$2:$A$30,"dddd")=$C2),--($B$2:$B$30
))

THANKS!



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default What is the -- in formulas?

The first minus changes true to -1 (and false to 0). The second minus changes
-1 to 1 (and 0 to 0).

=sumproduct() likes to work with numbers, so this is a quick way to change those
boolean values to numbers.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html

SheriTingle wrote:

Hello and thanks for the help. I have seen -- in formulas and I have no idea
what that means or why the use of a double negative sign. Could someone
please explain to me when this is used and why?

Here's an example of a formula I saw using the --

=SUMPRODUCT(--($A$2:$A$30<""),--(TEXT($A$2:$A$30,"dddd")=$C2),--($B$2:$B$30))

THANKS!


--

Dave Peterson
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
paste formulas between workbooks without workbook link ron Excel Discussion (Misc queries) 3 April 22nd 23 08:11 AM
Countif formulas change after doing a sort Bob Smith Excel Worksheet Functions 3 January 3rd 06 11:17 PM
Array Formulas take waaaay too long... belly0fdesire Excel Worksheet Functions 7 August 8th 05 10:11 PM
Problem with named formula's nathan Excel Worksheet Functions 0 January 21st 05 04:07 PM
calculating formulas for all workbooks in a folder Chad Excel Worksheet Functions 3 November 13th 04 05:22 PM


All times are GMT +1. The time now is 11:43 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"