![]() |
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! |
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! |
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 |
All times are GMT +1. The time now is 05:38 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com