Reputation: 573
I have a cell which contains column name in string "Col2"
and "Col3"
A2 B2
------- ------
Col2 Col3
Now I want to pull those string and place it inside my query function to select certain column.
I tried this:-
=Query(Sheet2!A1:P1993,"select Col1, "&sheet1!A2:B2&"")
But it did not work.
Upvotes: 0
Views: 311
Reputation: 1574
Your ampersand is on the wrong side of the quotation mark, try =Query(Sheet2!A1:P1993,"select Col1, &"sheet1!A2:B2"&")
.
The Query function uses a string select
statement so what you are really doing is creating that using ampersand to concatenate.
Upvotes: 1