Search code examples
sortinggoogle-sheetsarray-formulasgoogle-sheets-query

How can I sort the output from a query that includes an array formula?


I have a formula that queries two sheets in the document and pulls data to a third sheet. If I add new data to the first sheet after the query has completed and then go back to the third sheet (with the query results) the new data is not at the bottom of the combined list. It is at the bottom of the first section. The data sourced from the different sheets is kept together, all first then all second.

Is there a way to enforce sorting the entire output collectively by a particular column (preferably ColumnF)?

Spreadsheet with sample data here.

enter image description here


Solution

  • Please try:

    =sort(ARRAYFORMULA({QUERY(Sheet1!A1:I500, "Select * where G = 'no'", 0); (QUERY(sheet2!A1:I500, "Select * where G = 'no'", 0))}),6,1)