Google-sheets – Query with dropdown not working

formulasgoogle sheetsgoogle-sheets-query

In my Google sheet I'm getting an error:

Unable to parse query string for Function QUERY parameter 2: NO_COLUMN:

I've added a dropdown so the formula will auto-update depending on the tab selected.

Here's the formula that I'm getting an error:

=AVERAGE(query(""&B1&""&C1&"!!A2:I","Select Col9 where Col2='"&A5&"'"))

And here's the formula that's working:

=AVERAGE(query('2019年5月'!A$2:I,"Select I where B='"&A5&"'"))

Can somebody help me with this, please?

Best Answer

=AVERAGE(QUERY({INDIRECT(B1&C1&"!A2:I")}, "select Col9 where Col2 = '"&A5&"'"))

0