Google Sheets QUERY – ORDER BY Not Working Solutions

google sheetsgoogle-sheets-query

Please consider this sheet:
https://docs.google.com/spreadsheets/d/1qIbyvtr2OpjD25OxeMjId1PbtVKmcI6V_KvCJqzs7U8/edit#gid=151995974

In the TestSelect Sheet, I've entered 2 QUERYformulas:

  • in A1, I've entered this formula =QUERY(Sheet1!A:B;"SELECT A,B") and it works well
  • in D1, I've added an ORDER BYcriteria, like this =QUERY(Sheet1!A:B;"SELECT A,B ORDER BY B")

The second formula does not work at all. There's no syntax error but no result too. Have I made a mistake in my formula ? I've tried to add DESC or ASC after the column letter but it change nothing…

enter image description here

Best Answer

The formula works fine.

The issue is that blank cells are counted first.
You can find your rows with data in the end of the document.

Exclude blank cells to correct the view you by using the following formula.

=QUERY(Sheet1!A:B;"select A,B where A<>'' order by B";1)

enter image description here