【问题标题】:Excel: how to do something like: select count(col3,col4,col5,col6,col7) from TBL where col2 = '1-Jan';Excel:如何执行以下操作:从 TBL 中选择 count(col3,col4,col5,col6,col7) where col2 = '1-Jan';
【发布时间】:2012-01-03 15:53:40
【问题描述】:

目前,我正在使用复杂的 countifs() 语句:

=countifs($B$2:$B$B1000,"="&L7,'Sheet2'!$C$2:$C$1000,"*")+
 countifs($B$2:$B$B1000,"="&L7,'Sheet2'!$D$2:$D$1000,"*")+
 countifs($B$2:$B$B1000,"="&L7,'Sheet2'!$E$2:$E$1000,"*")+
 countifs($B$2:$B$B1000,"="&L7,'Sheet2'!$F$2:$F$1000,"*")+
 countifs($B$2:$B$B1000,"="&L7,'Sheet2'!$G$2:$G$1000,"*")

它有效地对每一列执行全表扫描,而且速度非常慢。 必须有更好的方法来做到这一点!有什么建议吗?

我想要完成的是计算给定日期内包含某些内容的单元格的数量:

  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    |

【问题讨论】:

    标签: excel count multiple-columns formulas


    【解决方案1】:

    不确定是否会更快......但肯定会更短

    =SUMPRODUCT(($B$2:$B1000=L7)*(Sheet2!$C$2:$G$1000""))

    【讨论】:

    • 这太棒了!它加快了这个过程至少 1000 倍!谢谢!
    猜你喜欢
    • 2023-03-22
    • 1970-01-01
    • 2018-10-13
    • 1970-01-01
    • 1970-01-01
    • 2013-09-17
    • 2017-09-27
    • 1970-01-01
    • 2015-05-15
    相关资源
    最近更新 更多