为什么在执行包含算术运算的查询时,我的输出顶部会出现多余的运算符字符串?
Why do I get a superfluous operator string at the top of my output when performing a query that includes an arithmetic operation?
我一直在使用 =query()
函数从我的 sheet 中的 table 获取子列表。
假设初始数据集是这样的...
Sheet1
A | B | C | D
-----+-----+-----+-----
1st | X | 10 | 20
2nd | X | 20 | 20
3rd | Y | 30 | 20
4th | X | 40 | 10
然后我可以使用这样的查询来获取子列表...
=query(Sheet1!A:D,"select A,C,D where B='X'")
这让我...
1st | 10 | 20
2nd | 20 | 20
4th | 40 | 10
我不得不笨拙地解决的一件事是,当我尝试在查询中使用算术运算时,我在输出中得到了意外的额外字符串,根据 Google's reference page.
假设我尝试这些查询,例如...
=query(Sheet1!A:D,"select A,C+D where B='X'")
=query(Sheet1!A:D,"select A,C-D+100 where B='X'")
...我期待以下...
1st | 30
2nd | 40
4th | 50
1st | 90
2nd | 100
4th | 130
...这几乎可以工作,除了我在顶部得到一个多余的函数字符串,所以输出最终看起来像这样...
sum()
1st | 30
2nd | 40
4th | 50
sum(difference()100())
1st | 90
2nd | 100
4th | 130
如您所见,除了顶部那些烦人的字符串外,这些值都是正确的。这是一个错误吗?有什么基本的我跳过或使用不正确吗?感谢您的帮助。
这确实很正常。为了摆脱标签,您可以将它们设置为空白,如下所示:
=query(B:E;"select B,D+E where C='X' label (D+E)'' ")
我一直在使用 =query()
函数从我的 sheet 中的 table 获取子列表。
假设初始数据集是这样的...
Sheet1
A | B | C | D
-----+-----+-----+-----
1st | X | 10 | 20
2nd | X | 20 | 20
3rd | Y | 30 | 20
4th | X | 40 | 10
然后我可以使用这样的查询来获取子列表...
=query(Sheet1!A:D,"select A,C,D where B='X'")
这让我...
1st | 10 | 20
2nd | 20 | 20
4th | 40 | 10
我不得不笨拙地解决的一件事是,当我尝试在查询中使用算术运算时,我在输出中得到了意外的额外字符串,根据 Google's reference page.
假设我尝试这些查询,例如...
=query(Sheet1!A:D,"select A,C+D where B='X'")
=query(Sheet1!A:D,"select A,C-D+100 where B='X'")
...我期待以下...
1st | 30
2nd | 40
4th | 50
1st | 90
2nd | 100
4th | 130
...这几乎可以工作,除了我在顶部得到一个多余的函数字符串,所以输出最终看起来像这样...
sum()
1st | 30
2nd | 40
4th | 50
sum(difference()100())
1st | 90
2nd | 100
4th | 130
如您所见,除了顶部那些烦人的字符串外,这些值都是正确的。这是一个错误吗?有什么基本的我跳过或使用不正确吗?感谢您的帮助。
这确实很正常。为了摆脱标签,您可以将它们设置为空白,如下所示:
=query(B:E;"select B,D+E where C='X' label (D+E)'' ")