1

I have several queries. Each week they need to shift one column right, C to D then E...W.

I currently manually change C to D in all my queries and I want to simplify.

A couple of examples:

select B,C,AM,AN,AP,AQ where C = 'Available' order by AM limit 20

and

select B,AM,AN where C = 'Available' order by AM limit 12

I've tried to make the query select dynamic and reference a cell "H2" with the new column select letter, so all the queries select change based on "H2" value C or D ... or W.

I've tried new value in "H2" is D,

select B,AM,AN where "H2" = 'Available' order by AM limit 12

select B,AM,AN where "&H2&" = 'Available' order by AM limit 12

select B,AM,AN where """&H2&""" = 'Available' order by AM limit 12

nothing works, any suggestions?

2 Answers 2

2

Your second version is correct. For example,

=query(B:G, "select B where " & H2 & " = 'Available'")

works correctly in my spreadsheet when H2 contains a letter such as C or D or E.

0
select B,AM,AN where "&$A&" = 'Available' order by AM limit 12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.