I have this formula:

                     "select Col1, sum(Col5), count(Col4), sum(Col3) 
                      where Col1<>'' group by Col1 format sum(Col5) 'h:mm:ss'"),
               "select* offset 1",0), 

                     "select D, A, sum(C) group by A, D"), 
               "select max(Col3), Col2 group by Col2 label max(Col3)''"), 
         "select Col1")&unique(sort(filter(A4:A, len(A4:A)))), 

 {query(query(A4:D, "select sum(C), A, D  group by A, D"), 
        "select Col1",0)&

       "select sum(C), A, D group by A, D"), 
 "select Col2",0),

       "select sum(C), A, D  group by A, D"), 
 "select  Col3",0)}, 2, 0)})

I got it from a response to another question here in Web Applications, this is an example, I am trying to apply it to my real sheet.

The thing is that this formula is going to be in a different sheet (in one sheet the raw data, in another sheet the analytics using this formula), so how can I call Col1, Col2, etc from another sheet?

Can I mix in the same sentence columns from different sheets?

Example: "Select sheet1!Col1, sum(Col5), count(sheet1!Col4)"

2 Answers 2


Instead of just using the ranges, you will have to add the sheet name..


  • 1
    I Hopea) you only reference one other sheet (the sheet with the 'source data'). Only add in the sheetname where you see ranges, NOT in the select clause of the query like in the example you gave.
    – JPV
    Jan 16, 2015 at 18:55
  • Is this wrong? =ArrayFormula({query(query({'SHEETNAME1'!A3:D,value('SHEETNAME2'!B3:B)}....ETC Jan 16, 2015 at 19:06
  • @elunicotomas: looks ok
    – JPV
    Jan 16, 2015 at 19:30
  • sorry, what I was actually asking is to reference that formula in "select Col1, sum (Col5) ... ETC", after the "query" part, is it clear?? Jan 19, 2015 at 17:04

Select sheet1!Col1, sum(Col5), count(sheet1!Col4)"

This cannot be done. You can only reference them outside the query formula. Not inside.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.