如何在 QUERIE 的第二个参数中使用多个 TEXT 函数?
How to use multiple TEXT funtions in QUERY's second argument?
在第二个参数中使用 Query
函数和 text()
或 To_text()
函数对我来说完全没问题,如本例所示:
=QUERY({June2019!$M:$Z;July2019!$M:$Z;August2019!$M:$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:$Z;July2019!$M:$Z;August2019!$M:$Z},"select
SUM(Col5) where (Col1 > "&text((Column()-2)*5,"#")&") and (Col1 <=
"&text((Column()-1)*5,"#")&") label SUM(Col5)
''"))/(QUERY({June2019!$M:$Z;July2019!$M:$Z;August2019!$M:$Z},"select
COUNT(Col5) where (Col1 > "&text((Column()-2)*5,"#")&") and (Col1 <=
"&text((Column()-1)*5,"#")&") label COUNT(Col5) ''")),)
Error:
Query completed with an empty output.
Error:
Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "Col1 "" at line 1, column 24. Was expecting one of: "(" ... "(" ...
如有任何帮助,我们将不胜感激
尝试:
=ARRAYFORMULA(IF(ISBLANK(B27:27)=FALSE,
QUERY({June2019!$M:$Z; July2019!$M:$Z; August2019!$M:$Z},
"select SUM(Col5)
where Col1 > "&(COLUMN()-2)*5&"
and Col1 <= "&(COLUMN()-1)*5&"
label SUM(Col5)''")/
QUERY({June2019!$M:$Z; July2019!$M:$Z; August2019!$M:$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:$Z; July2019!$M:$Z; August2019!$M:$Z},
"select avg(Col5)
where Col1 > "&(COLUMN()-2)*5&"
and Col1 <= "&(COLUMN()-1)*5&"
label avg(Col5)''"), ))
在第二个参数中使用 Query
函数和 text()
或 To_text()
函数对我来说完全没问题,如本例所示:
=QUERY({June2019!$M:$Z;July2019!$M:$Z;August2019!$M:$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:$Z;July2019!$M:$Z;August2019!$M:$Z},"select
SUM(Col5) where (Col1 > "&text((Column()-2)*5,"#")&") and (Col1 <=
"&text((Column()-1)*5,"#")&") label SUM(Col5)
''"))/(QUERY({June2019!$M:$Z;July2019!$M:$Z;August2019!$M:$Z},"select
COUNT(Col5) where (Col1 > "&text((Column()-2)*5,"#")&") and (Col1 <=
"&text((Column()-1)*5,"#")&") label COUNT(Col5) ''")),)
Error: Query completed with an empty output.
Error: Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "Col1 "" at line 1, column 24. Was expecting one of: "(" ... "(" ...
如有任何帮助,我们将不胜感激
尝试:
=ARRAYFORMULA(IF(ISBLANK(B27:27)=FALSE,
QUERY({June2019!$M:$Z; July2019!$M:$Z; August2019!$M:$Z},
"select SUM(Col5)
where Col1 > "&(COLUMN()-2)*5&"
and Col1 <= "&(COLUMN()-1)*5&"
label SUM(Col5)''")/
QUERY({June2019!$M:$Z; July2019!$M:$Z; August2019!$M:$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:$Z; July2019!$M:$Z; August2019!$M:$Z},
"select avg(Col5)
where Col1 > "&(COLUMN()-2)*5&"
and Col1 <= "&(COLUMN()-1)*5&"
label avg(Col5)''"), ))