The result is the range C4:L5 sorted by score in descending order. However, the SORT function has an optional argument called “by_col” which allows sorting values organized in columns. To sort by column, this argument must be set to TRUE, which tells the SORT function that sort_index represents a row. In this case, we want to sort the data by Score, which appears in the second row, so we use a sort_index of 2. The SORT function that appears in C8 is configured like this:

array is the data in the range C4:L5 sort_index is 2, since score is in the second row sort_order is -1, since we want to sort in descending order by_col is TRUE, since data is organized in columns

The SORT function returns the sorted array into the range C8:L9. This result is dynamic; if any scores in the source data change, the results will automatically update.

With SORTBY

The SORTBY function can also be used to solve this problem. With SORTBY, the equivalent formula is:

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.