【问题标题】:I want to use this query as an arrayformula我想将此查询用作数组公式
【发布时间】:2019-12-03 08:43:05
【问题描述】:

谁能建议我如何将此查询转换为可在数组公式中使用的查询?

=iferror(QUERY(importorders!A:H,"Select count(A) where C = 'Thailand Tour' and month(H) = "&MONTH(A3)-1&"and year(H) = "&year(A3)&" label count(A) ''",1),0)

基本上就是统计我每个月有多少订单。

感谢收看。

View sheet (image)

表格:https://docs.google.com/spreadsheets/d/1Of6cdFYaOzCFwPdZ4ABItD6dghMjHhafRWmDJWaznbg/edit#gid=711075203

【问题讨论】:

标签: google-sheets google-sheets-formula array-formulas google-sheets-query gs-vlookup


【解决方案1】:

尝试:

=ARRAYFORMULA(IFNA(VLOOKUP(A3:A, QUERY({importorders!A2:C, 
 EOMONTH(importorders!H2:H, -1)+1},
 "select Col4,count(Col1) 
  where Col3 = 'Thailand Tour' 
    and Col4 is not null 
  group by Col4
  label count(Col1)''", 0), 2, 0), 0))

【讨论】:

    【解决方案2】:

    你必须使用group by

    只为Thailand Tour获取

    =iferror(QUERY(importorders!A:H,"Select count(A) where C = 'Thailand Tour' and month(H) = "&MONTH(A3)-1&"and year(H) = "&year(A3)&" group by C label count(A) ''",1),0)

    要获得整个列的结果,试试这个

    =iferror(QUERY(importorders!A:H,"Select count(A) where month(H) = "&MONTH(A3)-1&"and year(H) = "&year(A3)&" group by C label count(A) ''",1),0)

    (带有预期结果的演示表会很有帮助)

    【讨论】:

    猜你喜欢
    • 2023-04-04
    • 2021-04-07
    • 1970-01-01
    • 2021-11-29
    • 2023-04-10
    • 2018-09-13
    • 2018-02-01
    • 2019-02-21
    • 2021-03-24
    相关资源
    最近更新 更多