Home > OS >  query order by 2nd column when score is equal
query order by 2nd column when score is equal

Time:12-09

I'm using this formula to order column G to sort the highest points of the player list.

=QUERY(A2:G;"select * where A is not null order by G desc";0)

Some of the players have equal total points, but not equal times. Points are earned over different rounds, based on what time they finished.

If the players have equal points, I want to sort by a second column (their total finishing time) in column H.

example: Both players finished 1st & 2nd. The total time has a difference of 1 minute. Player 2 should be ordered first based on his total time. Note that I can't directly order by "Total Time" due to the point system in the background.

Player   Round1   Round2   Points   Total Time
  1       3min     1min      10        4min
  2       1min     2min      10        3min

CodePudding user response:

Found it!

=QUERY(A2:G;"select * where A is not null order by G desc, H asc";0)
  • Related