Kristi Miller
Kristi Miller

Reputation: 61

Multiple Sort ( ORDER BY ) within Query in Google Sheets

What am I missing here?

=QUERY('STUDENT SIGN IN'!A1:K, "select K,C,F,D,E,B ORDER BY A DESC, B"

The data is sorting on Column A, but doing nothing to Column B.

Since that didn't work, I also tried building it this way, however I haven't done a vested formula in sheets before. This formula is causing a #ERROR:

=SORT((QUERY('STUDENT SIGN IN'!A1:K, "select K,C,F,D,E,B)")Select 1,TRUE,2,FALSE))

Upvotes: 6

Views: 27764

Answers (2)

Saa
Saa

Reputation: 151

Question: =QUERY('STUDENT SIGN IN'!A1:K, "select K,C,F,D,E,B ORDER BY A DESC, B"

Answer: =QUERY('STUDENT SIGN IN'!A1:K, "select K,C,F,D,E,B ORDER BY A,B DESC")

Both will be ASC or DESC

Question: =SORT((QUERY('STUDENT SIGN IN'!A1:K, "select K,C,F,D,E,B)")Select 1,TRUE,2,FALSE))

Answer: =SORT(QUERY('STUDENT SIGN IN'!A1:K,"select K,C,F,D,E,B"),1,TRUE,2,FALSE)

Each One can Be ASC Or DESC

Upvotes: 0

pnuts
pnuts

Reputation: 59450

If the order for ColumnB is not changing then it is presumably already in the default (ascending) order within each ColumnA value. To reverse this as well as the order of ColumnA you might try:

=QUERY('STUDENT SIGN IN'!A1:K, "select K,C,F,D,E,B ORDER BY A DESC, B desc")

Upvotes: 10

Related Questions