Mask
Mask

Reputation: 573

column adding in query function gives additional field

Hi am simply trying to add two columns but this formula gives me one additional field sun() in a cell. Look at the picture for this strange behaviour:

enter image description here

the formula i used is this :

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

What is going on and how to resolve this?

Upvotes: 0

Views: 54

Answers (2)

player0
player0

Reputation: 1

you can remove it if you use:

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

or like this:

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

Upvotes: 1

marikamitsos
marikamitsos

Reputation: 10573

Please use the label clause as in:

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

How to hide headers in a query SUM

In your case the formula would be:

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

You do not need the extra () around the columns.

Upvotes: 2

Related Questions