在查询函数中添加的列会提供额外的字段

column adding in query function gives additional field

您好,我只是想添加两列,但是这个公式在一个单元格中给了我一个额外的字段 sun()。查看图片以了解这种奇怪的行为:

我使用的公式是这样的:

=QUERY({IMPORTRANGE("xxxxxxx","xxx!A1:Z")select Col1,Col2,Col3,Col4,Col5,(Col6)+(Col7),Col8")

这是怎么回事,如何解决?

请使用 label clause 如:

=QUERY(A1:B,"select A+B label A+B 'Total' ")

在您的情况下,公式为:

=QUERY({IMPORTRANGE("xxxxxxx","xxx!A1:Z")select Col1,Col2,Col3,Col4,Col5,Col6+Col7,Col8 label Col6+Col7 '' ",0)

您不需要在列周围添加额外的 ()

你可以删除它,如果你使用:

=QUERY({IMPORTRANGE("xxxxxxx", "xxx!A1:Z"), 
 "select Col1,Col2,Col3,Col4,Col5,Col6+Col7,Col8
  label Col6+Col7''")

或者像这样:

=QUERY(QUERY({IMPORTRANGE("xxxxxxx", "xxx!A1:Z"), 
 "select Col1,Col2,Col3,Col4,Col5,Col6+Col7,Col8"),
 "offset 1", 0)