Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
456 views
in Technique[技术] by (71.8m points)

dropdown - Google Sheets - QUERY order by dependent drop down

I am trying to setup a QUERY with dynamic ordering. I've tried to link the ORDER BY function to the output of the dropdown menu but that doesnt seem to work. I have recreated the problem with a simple example: https://docs.google.com/spreadsheets/d/1m3Lhm5lp2DW7XF8hRbDAiOAAsOyCXrie-Nc-0bWG6hA/edit?usp=sharing

I've created a table (3x4) with three variable and would like to dynamically sort the table by each variable through QUERY both ascending and descending.

Would also be interested to learn if it's possible to dynamically setup the direction (ACS or DESC).

Any suggestions would be much appreciated.

Kind regards,

Webko

question from:https://stackoverflow.com/questions/65851691/google-sheets-query-order-by-dependent-drop-down

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

try:

=QUERY({A2:C6}, "order by Col"&MATCH(F1, A2:C2, 0)&" "&G1)

enter image description here

where G1 dropdown is asc,desc


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...