Search code examples
google-sheetsgoogle-sheets-query

How to single sort multiple queries by the same condition in sheets?


I am trying to pull multiple sheets into one using the query function like so

={QUERY(Sheet2!A2:B, "SELECT A, B WHERE A <> ''");
  QUERY(Sheet3!A2:B, "SELECT A, B WHERE A <> ''")},... 

doing this is fine but I would like the queries to be mixed in as to show a compiled list by the date in an ascending order any ideas on how to do this?

Also, I have tried to include sort by statements but it does not mix all the queries into one.


Solution

  • all you need to do is to wrap it into another QUERY:

    =QUERY(
     {QUERY(Sheet2!A2:B, "SELECT A, B WHERE A <> ''");
      QUERY(Sheet3!A2:B, "SELECT A, B WHERE A <> ''")},
     "order by Col1")