Sorting Data - Reorder complete records
Use Excel's Sort dialog for region groups and descending amounts without separating an order ID from the amount it describes.
By the end, you can
- Sort the full record rectangle.
- Use a primary and secondary sort level.
- Distinguish an in-place sort from the SORT formula's output.
Before you start: Understand headers and one record per row. Steps use the Windows desktop Data ribbon.
In this lesson
Change record order while preserving relationships
The Data ribbon's Sort command changes the order of source rows. It can group a report by region and order amounts within each group. The order ID, region, and amount must move together. Sorting only an amount column destroys those record relationships even though each column may still look plausible.
Before: orders in entry order
O101| A | B | C | |
|---|---|---|---|
| 1 | Order ID | Region | Amount INR |
| 2 | O101 | North | 12000 |
| 3 | O102 | South | 8000 |
| 4 | O103 | North | 18000 |
| 5 | O104 | South | 10000 |
| 6 | O105 | North | 6000 |
Apply a two-level sort in Excel
- Select a cell inside the contiguous A1:C6 source, or select the complete rectangle explicitly.
- Choose Data > Sort in the Sort & Filter group. Ensure My data has headers is enabled.
- Set Sort by to Region, Sort On to Cell Values, and Order to A to Z.
- Select Add Level. Set Then by to Amount INR and Order to Largest to Smallest.
- Confirm the sort. If Excel asks about sorting a selected column, choose Expand the selection when those adjacent columns form the same record.
- Compare the resulting record order and the total amount with the expected table; row relationships must remain intact.
O103| A | B | C | |
|---|---|---|---|
| 1 | Order ID | Region | Amount INR |
| 2 | O103 | North | 18000 |
| 3 | O101 | North | 12000 |
| 4 | O105 | North | 6000 |
| 5 | O104 | South | 10000 |
| 6 | O102 | South | 8000 |
Other useful sorting policies
- Choose Oldest to Newest for valid date values, A to Z for text, or a custom order when categories such as High/Medium/Low have a policy order.
- The top sort level is primary; later levels resolve equal primary keys. Reversing levels answers a different reporting question.
- Use Ctrl+Z promptly to undo an unintended sort. Keep an original sequence/index field if a later return to import order is required.
- The SORT or SORTBY formulas return separately ordered arrays; they do not perform the same in-place source-row operation.
Common mistakes and tips
The workspace has supported SORT/SORTBY formula tasks, but it does not simulate this native Sort dialog. No Practice link is labelled as an in-place sorting exercise.
Check your understanding
Choose an answer for instant feedback. You can try again; answers stay only on this page.