【问题标题】:How to compute the value based on criteria of other cells In Google Sheet Query?如何根据 Google Sheet Query 中其他单元格的条件计算值?
【发布时间】:2021-02-16 14:54:01
【问题描述】:

在Google Sheet Query中,如何根据其他单元格的条件计算值?

谢谢。

【问题讨论】:

  • 你的标准是什么?
  • 我需要添加 Mary 的所有 pass_A,而不是 Mary 的 pass_B。不知道怎么形容,不好意思

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


【解决方案1】:

试试下面的

=QUERY({A2:D6}, 
"select Col1, Col2, sum(Col3), sum(Col4) where Col1 is not null 
 group by Col1, Col2 
 label sum(Col3) '', sum(Col4) '' ",0)

【讨论】:

    【解决方案2】:

    尝试:

    =QUERY(QUERY(A1:D; 
     "select A,B,sum(C),max(D) 
      where A is not null 
      group by A,B");
     "offset 1"; 0)
    

    【讨论】:

    • 我认为 OP 也在 C 上取 D 的总和,而不是最大值。
    猜你喜欢
    • 1970-01-01
    • 2020-02-20
    • 1970-01-01
    • 1970-01-01
    • 2020-09-21
    • 2020-02-20
    • 1970-01-01
    • 2020-12-01
    • 1970-01-01
    相关资源
    最近更新 更多