title: Excel: how to do something like: select count(col3,col4,col5,col6,col7) from TBL where col2 = '1-Jan';
body: <p>Currently, I'm using a complex countifs() statement:</p>
  
  <pre><code>=countifs($B$2:$B$B1000,"="&amp;L7,'Sheet2'!$C$2:$C$1000,"*")+
   countifs($B$2:$B$B1000,"="&amp;L7,'Sheet2'!$D$2:$D$1000,"*")+
   countifs($B$2:$B$B1000,"="&amp;L7,'Sheet2'!$E$2:$E$1000,"*")+
   countifs($B$2:$B$B1000,"="&amp;L7,'Sheet2'!$F$2:$F$1000,"*")+
   countifs($B$2:$B$B1000,"="&amp;L7,'Sheet2'!$G$2:$G$1000,"*")
  </code></pre>
  
  <p>which is effectively performing a full table scan for each column and is ridiculously slow. There <em>has</em> to be a better way to do this! Suggestions?</p>
  
  <p>What I'm trying to accomplish is counting the number of cells that have something in them for a given dates:</p>
  
  <pre><code>  date  |  Col1   |   Col2   |   Col3  |   Col4   |
  ---------------------------------------------------
    1-Jan |    A    |     A    |         |    A     |
    1-Jan |    A    |          |         |    A     |
    2-Jan |    A    |          |         |          |
    2-Jan |    A    |     A    |    A    |    A     |
    2-Jan |    A    |          |         |          |
  
  
     Day  |  Totals |
  -------------------
    1-Jan |    5    |
    2-Jan |    6    |
  </code></pre>