【问题标题】:How to use multiple TEXT funtions in QUERY's second argument?如何在 QUERIEs 第二个参数中使用多个 TEXT 函数?
【发布时间】:2019-06-24 09:28:41
【问题描述】:

在第二个参数中使用Query 函数和text()To_text() 函数对我来说完全没问题,如下例所示:

=QUERY({June2019!$M$3:$Z;July2019!$M$3:$Z;August2019!$M$3:$Z},"select 
 SUM(Col5) where Col1 > "&text((Column()-2)*5,"#")&" and Col1 <= 
 "&text((Column()-1)*5,"#")&" label SUM(Col5) ''")

但是,一旦我以更复杂的方式使用此查询功能,就会出现以下两个错误之一:

=IF((ISBLANK(B27:27)=False), 
 (QUERY({June2019!$M$3:$Z;July2019!$M$3:$Z;August2019!$M$3:$Z},"select 
 SUM(Col5) where (Col1 > "&text((Column()-2)*5,"#")&") and (Col1 <= 
 "&text((Column()-1)*5,"#")&") label SUM(Col5) 
 ''"))/(QUERY({June2019!$M$3:$Z;July2019!$M$3:$Z;August2019!$M$3:$Z},"select 
 COUNT(Col5) where (Col1 > "&text((Column()-2)*5,"#")&") and (Col1 <= 
 "&text((Column()-1)*5,"#")&") label COUNT(Col5) ''")),)

错误: 查询完成,输出为空。


错误: 无法解析函数 QUERY 参数 2 的查询字符串:PARSE_ERROR:在第 1 行第 24 列遇到“”Col1“”。期待以下之一:“(”...“(”...

任何帮助将不胜感激

【问题讨论】:

    标签: google-sheets google-sheets-formula array-formulas google-sheets-query google-query-language


    【解决方案1】:

    尝试:

    =ARRAYFORMULA(IF(ISBLANK(B27:27)=FALSE, 
     QUERY({June2019!$M$3:$Z; July2019!$M$3:$Z; August2019!$M$3:$Z}, 
     "select SUM(Col5) 
      where Col1 >  "&(COLUMN()-2)*5&" 
        and Col1 <= "&(COLUMN()-1)*5&"
      label SUM(Col5)''")/
     QUERY({June2019!$M$3:$Z; July2019!$M$3:$Z; August2019!$M$3:$Z},
     "select COUNT(Col5) 
      where Col1 >  "&(COLUMN()-2)*5&"
        and Col1 <= "&(COLUMN()-1)*5&"
      label COUNT(Col5)''"), ))
    

    或:

    =ARRAYFORMULA(IF(ISBLANK(B27:27)=FALSE, 
     QUERY({June2019!$M$3:$Z; July2019!$M$3:$Z; August2019!$M$3:$Z}, 
     "select avg(Col5) 
      where Col1 >  "&(COLUMN()-2)*5&" 
        and Col1 <= "&(COLUMN()-1)*5&"
      label avg(Col5)''"), ))
    

    【讨论】:

      猜你喜欢
      • 2017-12-12
      • 1970-01-01
      • 1970-01-01
      • 2016-05-02
      • 2019-12-09
      • 1970-01-01
      • 2021-12-22
      • 2022-10-19
      • 2021-12-20
      相关资源
      最近更新 更多