【问题标题】:How to get count of different row combinations based on multiple column values?如何根据多列值获取不同行组合的计数?
【发布时间】:2020-11-15 22:02:09
【问题描述】:

如何打印出不同种类产品的数量?

ColumnB 的下拉菜单具有以下值:Red,Blue,Green
ColumnC 的下拉菜单具有以下值:方形、圆形
D列是计数

行数可以是例如200到那件事

对于示例输出信息应为:
红方 7
红圈 3
蓝色方块5

ColumnA       | ColumnB       | ColumnC       | ColumnD  
-------------------------------------------------------  
Customer name | Product color | Product shape | Count  
-------------------------------------------------------  
John Doe      | Red           | square        | 2  
John Doe      | Red           | circle        | 3  
Mary Doe      | Blue          | square        | 5  
Mary Doe      | Red           | square        | 5  

【问题讨论】:

    标签: google-sheets sum google-sheets-formula google-query-language


    【解决方案1】:

    尝试:

    =ARRAYFORMULA(QUERY({B:B&" "&C:C, D:D}, 
     "select Col1,sum(Col2) 
      where Col2 is not null 
      group by Col1 
      label sum(Col2)''"))
    

    【讨论】:

    • 谢谢 player0。可以分享一下你的试用吗?不知何故,我无法让你的公式在我自己的工作表中工作。
    • 太好了,非常感谢,甚至更多。是的,美国版和许多与美国版相关的在线示例通常可以工作,但其他语言版本需要一些修补
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多