google-sheets - 如何在 QUERY 的第二个参数中使用多个 TEXT 函数?
问题描述
在第二个参数中使用Query
带有text()
orTo_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“”。期待以下之一:“(”...“(”...
任何帮助,将不胜感激
解决方案
尝试:
=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)''"), ))
推荐阅读
- android - Android OpenCV 将 ROI 复制到较大图像的一部分
- macos - 在 macOS Mojave 上创建屏幕截图而不会丢失区域
- include - 如何通过 Sequelize 中包含模型的计算属性进行排序
- python - 如何从python中的xml文件中读取字典中的xml内容?
- java - JavaFX - 更改颜色后,TextField 提示文本不会在焦点时被删除
- vba - 从今天下载 .csv 附件
- c++ - c ++ while循环计时器的准确性变化很大
- ruby - 离线验证签名数据保险库
- android - AnimatorSet 和 Object/ValueAnimator 的持续时间有什么区别?
- java - 查找被点击视图的 ID 或标签