Can the column number in a where clause be a variable?
Here's a simple query:
=query(MasterData!B2:BR,"Select B where AJ <>''",1)
Is it possible to swap out AJ with something like:
=match($B$1,MasterData!2:2,0)
I've tried this but it doesn't work:
=query(MasterData!$B$2:$BR,"Select B where 'Col'& match($B$1,MasterData!2:2,0) <>''",1)
B1 is a drop down menu and AJ is Col36 The idea is to have the column the where clause evaluates driven by a menu.
Example Data: https://docs.google.com/spreadsheets/d/1L01n2U3cJgrt5ILKvv19cwYcBnc-lP7g0dWxrb8knNM/edit?usp=sharing
In this example, I'm trying to fix the formula in the "Query with variable column in WHERE" tab, cell A16
Thanks for the help!