Luke Ratz
Luke Ratz

Reputation: 11

adding sorting to Google Sheets Query with embedded formatting

=query(Sheet1!$A:$K,"select A,B,C,D,E,F,G,I,J,K where J IS NOT NULL format J'0%'")

Above is what I have right now in Google Sheets and I am trying to add a ordering function to it. I have tried

...J'0%', Order by B asc, C asc, D, asc

and nothing. Step two was to change everything to Col structure and try it again, but it couldn't find the Cols in the source "Sheet1" data. The formula as it is works fine, but I am having issues adding the ordering to it.

Any help would be greatly appreciated–thanks!

Upvotes: 0

Views: 93

Answers (2)

Chef1075
Chef1075

Reputation: 2724

There should be no comma before ORDER BY. Try:

=query(Sheet1!$A:$K,"select A,B,C,D,E,F,G,I,J,K where J IS NOT NULL ORDER BY B, C, D ASC FORMAT J'0%'")

Upvotes: 1

pnuts
pnuts

Reputation: 59475

order by must come before format. See The order of the clauses must be as follows:

enter image description here

Upvotes: 1

Related Questions