Right now, I can populate a sheet with data queried and that gets the destination column header name dynamically, using this:
=query(
Scenarios!A5:FQ,
"select "®EXEXTRACT(ADDRESS(5,MATCH(B2,Scenarios!A5:5,0)),"[A-Z] ")&"
where "®EXEXTRACT(ADDRESS(5,MATCH("PO #",Scenarios!A5:5,0)),"[A-Z] ")&" =
'"&$B$13&"'",0)
How can I use a similar approach when in this case?
=vlookup(AB9,Scenarios!A:BL,64,FALSE)
if order of columns matters:
=QUERY(FILTER(A7:C; REGEXMATCH(A7:C7; "Region|Rep")); "select Col2,Col1")
or you can try:
=INDEX(VLOOKUP(ROW(A7:A); {ROW(A7:A)\ B7:C}; {3\ 2}; 0))
or like:
=INDEX(VLOOKUP(ROW(A7:A); {ROW(A7:A)\ B7:C}; MATCH({"Rep"\ "Region"}; A7:C7; 0); 0))