With this formula, I can get a list of the columns with the highest total

=QUERY(A2:D5, "Select A,D Order by D Desc Limit 4")

enter image description here

But I can't figure out how to do the opposite, find the columns with the highest total, and return a list of that. (so it should list betty|12, aaron|6)

  • Please edit this question for clarity. It doesn't make sense as it's written. You already have those totals. Why do you want the totals row?
    – Blindspots
    Sep 14 at 0:19
  • I wanted the totals row to be sorted, to see which columns have the highest totals
    – stackers
    Sep 14 at 17:45

1 Answer 1


One option is to use TRANSPOSE. This function change columns to rows.

NOTE: When feeding QUERY with an array of values, like the result of transpose, instead of using the column letters as field names, use Col1, Col2, according to the column position of the feed array of values.

=QUERY(TRANSPOSE(A1:C5),"SELECT Col1,Col5 Order By Col5 Desc")
betty 12
aaron 6
  • 1
    Ah that's the key! I actually did see transpose, but when I tried it by selecting A (I assumed they would get remapped to the column letters), it said A didn't exist. ColX is the secret!
    – stackers
    Sep 14 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.