Google Sheets – Sort Column While Keeping Associated Values

formulasgoogle sheets

I have an Google Sheets spreadsheet that looks something like this:

|Team #|Rank|
|  100 | 4  |
|  200 | 3  |
|  234 | 6  |

I want to sort the teams by Rank, from best to worst, and then assign them a place (1st, 2nd, 3rd) based off of this rank. Basically, I need to move the data, but keep Team# and Rank coupled together. Example:

|Place|Team #|Rank|
|  1  |  234 | 6  |
|  2  |  100 | 4  |
|  3  |  200 | 3  |

But I need to do this in a formula because this information updates constantly (based on the output from other formulas).

How do I sort from highest to lowest in Rank but keep the associated Team #? I need to keep them together in order to score teams.

Best Answer

If the Team and Rank columns are B and C, then you need the formula

=sort(B2:C, 2, False) 

which sorts columns B and C according to the second one (C), in descending order (False). Note that the output of sort cannot overwrite the data in place. It has to be placed elsewhere, e.g., on a another sheet named "sorted".