0
0
Excelspreadsheet~10 mins

Sorting data (single and multi-level) in Excel - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Sample Data

Employee data with Name, Department, and Score columns.

CellValue
A1Name
B1Department
C1Score
A2Alice
B2Sales
C285
A3Bob
B3HR
C390
A4Charlie
B4Sales
C478
A5Diana
B5HR
C588
A6Evan
B6IT
C692
A7Fiona
B7Sales
C785
Formula Trace
=SORT(A2:C7, 2, 1, 3, 0)
Step 1: Original data range A2:C7
Step 2: Sort by column 2 (Department) ascending
Step 3: Within each Department group, sort by column 3 (Score) descending
Step 4: Final sorted array
Cell Reference Map
     A        B          C
1  Name   Department   Score
2  Alice  Sales       85
3  Bob    HR          90
4  Charlie Sales       78
5  Diana  HR          88
6  Evan   IT          92
7  Fiona  Sales       85

Formula references range A2:C7 for sorting by columns B and C.
The formula uses the data in cells A2:C7. It sorts first by column B (Department) ascending, then by column C (Score) descending.
Result
     A        B          C
1  Name   Department   Score
2  Bob    HR          90
3  Diana  HR          88
4  Evan   IT          92
5  Alice  Sales       85
6  Fiona  Sales       85
7  Charlie Sales       78

The data is sorted first by Department alphabetically, then by Score descending within each Department.
The sorted data shows HR employees first sorted by score descending, then IT, then Sales with scores sorted descending.
Sheet Trace Quiz - 3 Questions
Test your understanding
What is the first row of data after sorting by Department ascending and Score descending?
ADiana, HR, 88
BBob, HR, 90
CEvan, IT, 92
DAlice, Sales, 85
Key Result
SORT(range, sort_column1, sort_order1, sort_column2, sort_order2) sorts data by multiple columns in specified orders.