Search code examples
google-sheetsgoogle-sheets-apigoogle-query-language

In Google Sheets, How Do You Order a Query by row


I am trying to make a query and drop it into a table (really only a 5x5 grid of boxes with a black border color), but I want it to be ordered by row instead of column. I currently have the formula =QUERY(B14:J14) and I tried to make it =QUERY(B14:J15,"order by 15") but an error message came up because you can't use order to order by the row. Can someone please tell me if there is a way to make the query order by row number instead of by the column letter?


Solution

  • @eddyparkinson is correct, just need to "double transpose".

    =TRANSPOSE(QUERY(TRANSPOSE(B14:J15),"order by Col2"))