COUNTIF with dates

%3CLINGO-SUB%20id%3D%22lingo-sub-1526702%22%20slang%3D%22en-US%22%3ECOUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1526702%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20have%20students%20checking%20in%20various%20dates.%26nbsp%3B%20I%20have%20a%20column%20of%20check-in%20dates%20and%20would%20like%20to%20know%20how%20many%20have%20checked%20in%20as%20of%20today.%26nbsp%3B%20Set%20a%20cell%20(D59)%20for%20today's%20date%20(%3DTODAY())%20and%20used%20%3DCOUNTIF(E3%3AE55%2C%22%26gt%3B%3DD59%22)%20and%20it%20returns%20a%20value%20of%20zero.%26nbsp%3B%20Can%20I%20do%20this%20with%20COUNTIF%2C%20or%20is%20there%20another%20function%20I%20should%20use%3F%3C%2FP%3E%3CP%3EAlso%2C%20can%20I%20use%20the%20TODAY%20function%20in%20the%20COUNTIF%20function%20instead%20referring%20to%20the%20other%20cell%3F%26nbsp%3B%20What%20would%20that%20look%20like%3F%26nbsp%3B%20Thanks%20for%20your%20help.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1526702%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1526742%22%20slang%3D%22en-US%22%3ERe%3A%20COUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1526742%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F730838%22%20target%3D%22_blank%22%3E%40markyehl%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat's%20like%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DCOUNTIF(E3%3AE55%2C%22%26gt%3B%3D%22%20%26amp%3B%20D59)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1526764%22%20slang%3D%22en-US%22%3ERe%3A%20COUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1526764%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F730838%22%20target%3D%22_blank%22%3E%40markyehl%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20way%20you%20have%20coded%20the%20formula%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DCOUNTIF(%3CFONT%20color%3D%22%23FF00FF%22%3EE3%3AE55%3C%2FFONT%3E%2C%22%3CFONT%20color%3D%22%230000FF%22%3E%26gt%3B%3DD59%3C%2FFONT%3E%22)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Emakes%20the%20D59%20a%20literal%20text%20string%20and%20not%20a%20cell%20reference.%26nbsp%3B%20Try%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DCOUNTIF(%3CFONT%20color%3D%22%23FF00FF%22%3EE3%3AE55%3C%2FFONT%3E%2C%22%3CFONT%20color%3D%22%230000FF%22%3E%26gt%3B%3D%3C%2FFONT%3E%22%26amp%3B%3CFONT%20color%3D%22%23FF00FF%22%3ED59%3C%2FFONT%3E)%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1527070%22%20slang%3D%22en-US%22%3ERe%3A%20COUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1527070%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPeter%20and%20Sergei%20-%20thank%20you%20so%20much%2C%20it%20worked.%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20nest%20the%20TODAY%20function%20in%20the%20COUNTIF%20argument%20and%20not%20reference%20cell%20D59%3F%26nbsp%3B%20Just%20curious.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1527143%22%20slang%3D%22en-US%22%3ERe%3A%20COUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1527143%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F730838%22%20target%3D%22_blank%22%3E%40markyehl%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20understanding%20of%20challenge%20posted%20here%20is%20as%20follows%2C%3C%2FP%3E%3COL%3E%3CLI%3EStudent%20check-in%20dates%20are%20either%20%3CSTRONG%3EPast%3C%2FSTRONG%3E%20or%20%3CSTRONG%3EToday's%26nbsp%3B%20date.%3C%2FSTRONG%3E%3C%2FLI%3E%3CLI%3ENeeds%20to%20calculate%20how%20many%20total%20Students%20are%20active%20check%20in%20till%20date.%3C%2FLI%3E%3C%2FOL%3E%3CP%3EIf%20my%20understanding%20is%20correct%2C%20then%20formula%20should%20be%20as%20below%2C%20included%20today%20function%20in%20formula.%20Also%20please%20find%20attached%20sample%20sheet.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22sunil_daware_0-1594920001313.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F205844iD1C7CCE85D1F19F4%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22sunil_daware_0-1594920001313.png%22%20alt%3D%22sunil_daware_0-1594920001313.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EHope%20this%20will%20of%20help%20to%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1527396%22%20slang%3D%22en-US%22%3ERe%3A%20COUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1527396%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F730838%22%20target%3D%22_blank%22%3E%40markyehl%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%2C%20you%20can%20nest%20%3CSTRONG%3ETODAY%2C%3C%2FSTRONG%3E%20or%20other%20functions%2C%20to%20build%20a%26nbsp%3B%3CSTRONG%3ECOUNTIF%26nbsp%3B%3C%2FSTRONG%3Ecriterion%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DCOUNTIF(%3CFONT%20color%3D%22%23FF00FF%22%3EE3%3AE55%3C%2FFONT%3E%2C%22%3CFONT%20color%3D%22%230000FF%22%3E%26gt%3B%3D%3C%2FFONT%3E%22%26amp%3B%3CFONT%20color%3D%22%23000000%22%3ETODAY()%3C%2FFONT%3E)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EIt%20is%20also%20possible%20to%20'hard-wire'%20the%20number%20as%20text%20within%20the%20criterion%20string%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DCOUNTIF(%3CFONT%20color%3D%22%23FF00FF%22%3EE3%3AE55%3C%2FFONT%3E%2C%22%3CFONT%20color%3D%22%230000FF%22%3E%26gt%3B%3D44028%3C%2FFONT%3E%22)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DCOUNTIF(%3CFONT%20color%3D%22%23FF00FF%22%3EE3%3AE55%3C%2FFONT%3E%2C%22%3CFONT%20color%3D%22%230000FF%22%3E%26gt%3B%3D16%2F07%2F2020%3C%2FFONT%3E%22)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EWhat%20(sadly)%20is%20not%20allowed%20is%20to%20use%20a%20function%20within%20the%20criterion%20range%2C%3CEM%3E%20e.g.%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DCOUNTIF(MONTH(%3CFONT%20color%3D%22%23FF00FF%22%3EE3%3AE55%3C%2FFONT%3E)%2C%22%3CFONT%20color%3D%22%230000FF%22%3E%26gt%3B6%3C%2FFONT%3E%22)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3Ebecause%20that%20converts%20a%20range%20reference%20into%20an%20array.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1527824%22%20slang%3D%22en-US%22%3ERe%3A%20COUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1527824%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F730838%22%20target%3D%22_blank%22%3E%40markyehl%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnd%20if%20you%20are%20on%20Excel%20365%20it%20could%20be%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DSUM(--(E3%3AE55%26gt%3B%3DTODAY())%20)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EDouble%20dash%20is%20needed%20to%20convert%20logical%20TRUE%20or%20FALSE%20into%201%20or%200.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1529121%22%20slang%3D%22en-US%22%3ERe%3A%20COUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1529121%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAt%20various%20times%2C%20I%20have%20used%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3D%20SUM(SIGN(Boolean%23))%20'The%20help%20page%20doesn't%20even%20mention%20Booleans%0A%3D%20SUM(%2BN(Boolean%23))%20%20%20'Documented%20but%20does%20not%20accept%20arrays%0A%3D%20SUM(--Boolean%23)%20%20%20%20%20'Mathematically%20obscure%20syntax%20that%20would%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20appear%20to%20be%20a%20null%20operator%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eand%20have%20still%20to%20commit%20to%20one.%26nbsp%3B%20Is%20there%20an%20'officially%20approved'%20strategy%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1529647%22%20slang%3D%22en-US%22%3ERe%3A%20COUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1529647%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%2C%20I%20don't%20think%20any%26nbsp%3B%3CSPAN%3E'officially%20approved'%20strategy%20exists.%20With%20SIGN%20that's%20a%20good%20finding%2C%20but%20from%20my%20point%20of%20view%20is%20not%20practical%20for%20such%20purposes.%20If%20collect%20variants%20you%20forgot%3C%2FSPAN%3E%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3D%20SUM(Boolean%23%2B0)%0A%3D%20SUM(Boolean%23*1)%0A%3D%20SUM(Boolean%23*Boolean%23)%0A%3D%20-SUM(-Boolean%23)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EPerhaps%20something%20else%2C%20that's%20Excel%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1529875%22%20slang%3D%22en-US%22%3ERe%3A%20COUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1529875%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3EPerhaps%20something%20else%2C%20that's%20Excel%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%3CP%3ETrue%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1530004%22%20slang%3D%22en-US%22%3ERe%3A%20COUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1530004%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%20basically%20your%20examples%20here%20are%20that%20any%20math%20action%20will%20prompt%20Excel%20to%20try%20to%20convert%20the%20values%2C%20in%20this%20case%20Boolean%2C%20to%20a%20number.%26nbsp%3B%20The%20very%20popular%20%22--%22%20forces%20a%20negate%20and%20then%20negate%20again%20so%20you%20end%20up%20with%20the%20%22original%20value%22%20as%20a%20value%20instead%20of%20text%20or%20Boolean.%20I%20suspect%20its%20popularity%20is%20that%20it%20is%20probably%26nbsp%3B%3CSPAN%3Ethe%20most%20compact%20way%20to%20force%20a%20conversion%20and%20result%20in%20the%20%22same%22%20value%20and%20is%20visually%20unobtrusive.%26nbsp%3B%20I'm%20sure%20you%20two%20already%20know%20all%20this%20but%20thought%20I%20would%20add%20it%20for%20others%20that%20might%20read%20this%20thread.%26nbsp%3B%20%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1530080%22%20slang%3D%22en-US%22%3ERe%3A%20COUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1530080%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYes%2C%20double%20dash%20is%20most%20popular%20as%20the%20fastest%20way%20from%20typing%20point%20of%20view.%20And%20at%20the%20same%20time%20is%20most%20confusing%20one%2C%20Since%20quite%20many%20people%20don't%20know%20about%20the%20difference%20between%20negation%20and%20subtraction%2C%20Excel%20designers%20didn't%20find%20separate%20character%20for%20the%20negation%20in%20ANSII%20table.%20Thus%20people%20are%20surprised%20why%20%3D-Booleans%23%20works%2C%20but%20%3D%2BBooleans%23%20not%3B%20or%20why%26nbsp%3B%3D-6%5E2%20returns%20plus%2036%2C%20not%20minus%2036.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1530092%22%20slang%3D%22en-US%22%3ERe%3A%20COUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1530092%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20are%20right%3B%20I%20probably%20should%20have%20referred%20to%20the%20more%20positive%20features%20of%20'--'%20rather%20than%20limiting%20my%20comment%20to%20the%20more%20negative%20'mathematically%20obscure'.%26nbsp%3B%20I%20do%20remember%20being%20disoriented%20by%20it%2C%20though%2C%20when%20I%20first%20encountered%20the%20notation%20in%20a%20SUMPRODUCT%2C%20but%20one%20gets%20used%20to%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1530112%22%20slang%3D%22en-US%22%3ERe%3A%20COUNTIF%20with%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1530112%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESome%20ago%20(long%20ago)%20I%20shifted%20in%20SUMPRODUCT()%20on%20*1%20since%20had%20couple%20of%20cases%20when%20people%20removed%20double%20dash%20considering%20minus%20on%20minus%20in%20any%20case%20returns%20plus%2C%20and%20two%20minuses%20only%20complicate%20the%20formula%2C%20But%20now%20I'm%20again%20mostly%20on%20double%20dash.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

We have students checking in various dates.  I have a column of check-in dates and would like to know how many have checked in as of today.  Set a cell (D59) for today's date (=TODAY()) and used =COUNTIF(E3:E55,">=D59") and it returns a value of zero.  Can I do this with COUNTIF, or is there another function I should use?

Also, can I use the TODAY function in the COUNTIF function instead referring to the other cell?  What would that look like?  Thanks for your help.

13 Replies

@markyehl 

That's like

=COUNTIF(E3:E55,">=" & D59)

@markyehl 

The way you have coded the formula

=COUNTIF(E3:E55,">=D59")

makes the D59 a literal text string and not a cell reference.  Try

=COUNTIF(E3:E55,">="&D59)

@Peter Bartholomew 

Peter and Sergei - thank you so much, it worked.

Is there a way to nest the TODAY function in the COUNTIF argument and not reference cell D59?  Just curious.

Hello, @markyehl 

 

My understanding of challenge posted here is as follows,

  1. Student check-in dates are either Past or Today's  date.
  2. Needs to calculate how many total Students are active check in till date.

If my understanding is correct, then formula should be as below, included today function in formula. Also please find attached sample sheet.

sunil_daware_0-1594920001313.png

Hope this will of help to you.

 

@markyehl 

Yes, you can nest TODAY, or other functions, to build a COUNTIF criterion

=COUNTIF(E3:E55,">="&TODAY())

It is also possible to 'hard-wire' the number as text within the criterion string

=COUNTIF(E3:E55,">=44028")

=COUNTIF(E3:E55,">=16/07/2020")

What (sadly) is not allowed is to use a function within the criterion range, e.g.

=COUNTIF(MONTH(E3:E55),">6")

because that converts a range reference into an array.

@markyehl 

And if you are on Excel 365 it could be

=SUM(--(E3:E55>=TODAY()) )

Double dash is needed to convert logical TRUE or FALSE into 1 or 0.

@Sergei Baklan 

At various times, I have used

 

= SUM(SIGN(Boolean#)) 'The help page doesn't even mention Booleans
= SUM(+N(Boolean#))   'Documented but does not accept arrays
= SUM(--Boolean#)     'Mathematically obscure syntax that would 
                       appear to be a null operator

 

and have still to commit to one.  Is there an 'officially approved' strategy?

 

 

@Peter Bartholomew , I don't think any 'officially approved' strategy exists. With SIGN that's a good finding, but from my point of view is not practical for such purposes. If collect variants you forgot

= SUM(Boolean#+0)
= SUM(Boolean#*1)
= SUM(Boolean#*Boolean#)
= -SUM(-Boolean#)

Perhaps something else, that's Excel

@Sergei Baklan 

Perhaps something else, that's Excel

True

@Sergei Baklan  basically your examples here are that any math action will prompt Excel to try to convert the values, in this case Boolean, to a number.  The very popular "--" forces a negate and then negate again so you end up with the "original value" as a value instead of text or Boolean. I suspect its popularity is that it is probably the most compact way to force a conversion and result in the "same" value and is visually unobtrusive.  I'm sure you two already know all this but thought I would add it for others that might read this thread.   

@mtarler 

Yes, double dash is most popular as the fastest way from typing point of view. And at the same time is most confusing one, Since quite many people don't know about the difference between negation and subtraction, Excel designers didn't find separate character for the negation in ANSII table. Thus people are surprised why =-Booleans# works, but =+Booleans# not; or why =-6^2 returns plus 36, not minus 36.

@mtarler 

You are right; I probably should have referred to the more positive features of '--' rather than limiting my comment to the more negative 'mathematically obscure'.  I do remember being disoriented by it, though, when I first encountered the notation in a SUMPRODUCT, but one gets used to it.

@Peter Bartholomew 

Some ago (long ago) I shifted in SUMPRODUCT() on *1 since had couple of cases when people removed double dash considering minus on minus in any case returns plus, and two minuses only complicate the formula, But now I'm again mostly on double dash.