Dynamic sheet name in a request in Google Spreashheet

In a Google spreadsheet, I want to request data on another sheet, but the problem is that the sheet name is present in the cell. So, there is a way in QUERY to dynamically mention a sheet name. Basically I am trying to do something similar, but with a dynamic sheet name:

=QUERY('2012'!A2:F;"select C, sum(F) where A='December' group by C order by sum(F) desc")

I tried to do this, but get Parse Error:

 =QUERY(INDIRECT("Overview!L5")!A2:F;"select C, sum(F) where A='December' group by C order by sum(F) desc") 

In which Review! L5 is the cell with the sheet name for the request. I also tried to combine the quotes around INDIRECT, but that didn't work either.

I think it’s quite obvious what I'm trying to do from the query, that is, get the sum of the values ​​in the cells, grouped by the values ​​in other cells.

+4
source share
1 answer

DIRECTLY looks like a problem. Try it like this:

 =query(INDIRECT(A1&"!A5:A10"),"select Col1") 

i.e. if cell A1 contains "food", it is higher than:

 =query(food!A5:A10,"select A") 

and the same as:

 =query(INDIRECT("food!A5:A10"),"select *") 

** Note: indirect use of "Col1", etc., not "A", because it does not pass the letter col.

Also ... the google groups forum can be a good place to find spreadsheet formula answers. productforums.google.com/forum/#! Category / Documents / Tables

+8
source

All Articles