0
0
Excelspreadsheet~10 mins

Custom sorting rules in Excel - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Sample Data

List of fruits with assigned priority numbers to define a custom sort order.

CellValue
A1Fruit
A2Banana
A3Apple
A4Cherry
A5Date
B1Priority
B23
B31
B42
B54
C1SortOrder
C2
C3
C4
C5
Formula Trace
=MATCH(A2, {"Apple","Cherry","Banana","Date"}, 0)
Step 1: MATCH("Banana", {"Apple","Cherry","Banana","Date"}, 0)
Cell Reference Map
    A       B       C
1 | Fruit | Priority | SortOrder
2 | Banana|    3    |  =MATCH(A2, {"Apple","Cherry","Banana","Date"}, 0)
3 | Apple |    1    |  =MATCH(A3, {"Apple","Cherry","Banana","Date"}, 0)
4 | Cherry|    2    |  =MATCH(A4, {"Apple","Cherry","Banana","Date"}, 0)
5 | Date  |    4    |  =MATCH(A5, {"Apple","Cherry","Banana","Date"}, 0)
Column A contains fruits, column B their priority numbers, and column C uses MATCH formula to assign sort order based on a custom list.
Result
    A       B       C
1 | Fruit | Priority | SortOrder
2 | Banana|    3    |    3
3 | Apple |    1    |    1
4 | Cherry|    2    |    2
5 | Date  |    4    |    4
The SortOrder column shows the position of each fruit in the custom list, which can be used to sort the data accordingly.
Sheet Trace Quiz - 3 Questions
Test your understanding
What does the MATCH formula return for 'Apple'?
A3
B1
C2
D4
Key Result
MATCH(value, {custom_list}, 0) returns the position of value in the custom list for sorting.