Search code examples
google-sheetsgoogle-sheets-formulagoogle-sheets-querygoogle-query-languageimportrange

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?


Solution

  • 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.