Google Sheets – How to Sort Query Results Manually

google sheetsgoogle-sheets-querysorting

My google sheet is importing data from another tab just for sorting purpose, however, when the sort is done manually (through Google Sheet menus), results are unpredictable.

The sheet is populated through:

=query(tabname!A4:G2000)

Best Answer

you can't use Data > Sort sheet by...

your sheet needs to be manually sorted by creating a filtered view by selecting your column and then: Data > Filter views... > Create new filter view > Sort A - Z

a downside is that it's a view so it won't stay like that after closing your spreadsheet.
also, note that formula needs to be outside or inside of the filtered area (eg. filter can't be created right on the formula)

EXAMPLE:


another approach would be to use:

  • =QUERY() in =SORT() like: =SORT(QUERY(tabname!A4:G2000); 1; 1)
  • =QUERY(tabname!A4:G2000; "select * order by A desc, B asc"; 1)