【问题标题】:Count all apples and good apples数一数所有的苹果和好苹果
【发布时间】:2018-03-13 23:42:54
【问题描述】:

在 Google 表格上,我目前有一个类似于“原始”表格的单元格:

原始:

Week Starting   Date    Apple type
12/31/2017  1/4/2018    Green
12/31/2017  1/5/2018    Green
1/7/2018    1/8/2018    Bad - Green
1/7/2018    1/8/2018    Bad - Green
1/7/2018    1/8/2018    Yellow
1/7/2018    1/9/2018    Green
1/7/2018    1/9/2018    Red
1/7/2018    1/9/2018    Red
1/7/2018    1/10/2018   Green
1/7/2018    1/10/2018   Yellow
1/7/2018    1/10/2018   Bad - Yellow
1/7/2018    1/12/2018   Yellow
1/14/2018   1/16/2018   Red
1/14/2018   1/16/2018   Yellow
1/21/2018   1/23/2018   Red
1/21/2018   1/23/2018   Bad - Red
1/21/2018   1/23/2018   Yellow

我想编写返回如下内容的公式: 总结:

Week Starting   Count of all apples Count of only good apples
12/31/17                   2                  2
1/7/18                     10                 7
1/14/18                    2                  2
1/21/18                    3                  2

我尝试了多个组合使用减号、引号等的计数,但仍然无法做到这一点。有人可以给我一些建议吗? :/

【问题讨论】:

    标签: excel excel-formula google-sheets countif


    【解决方案1】:

    这应该可以解决问题:

    G2:=COUNTIF(A2:A18,F2)
    H2:=G2-COUNTIFS($A$2:$A$18,F2,$C$2:$C$18,"*Bad*")

    这些公式也适用于 Google 表格

    【讨论】:

      【解决方案2】:

      对于

      =QUERY(FILTER({{A:B},{C1;IFERROR(REGEXEXTRACT(C2:C,"Bad"),"Good")}},A:A<>""),"select Col1, Count(Col2) group by Col1 pivot Col3", 1)

      是单公式解,结果是表格:

      Week Starting   Bad Good
      12/31/2017            2
      1/7/2018          3   7
      1/14/2018             2
      1/21/2018         1   2
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-05-29
        • 1970-01-01
        • 1970-01-01
        • 2013-02-15
        • 1970-01-01
        • 1970-01-01
        • 2021-09-10
        相关资源
        最近更新 更多