←Module 5
Lesson · 12 min

Sorting Data

Learn how to sort text, numbers, and custom lists in Excel. Master basic sorting, multi-level sorting, and logical ordering using the Sort dialog box.

By the end of this lesson you can

  • Sort by one column and by several columns in priority order
  • Explain why selecting a single column before sorting corrupts data
  • Use custom sort orders for non-alphabetical sequences
  • Recognize when a sort has gone wrong and recover

Video

Watch the lesson video, then complete the reading and challenge.

Lesson Notes

Read through the key concepts before you try the challenge.

The most destructive mistake in Excel

On the job

You organize the supply list at Lakeside Medical Associates.

You click the Item Name column, select just that column, and sort A to Z. The names reorder. The quantities, prices, and vendors do not. Every row now pairs a name with another item's data, and there is no way to tell what belonged with what.

Your task: Sort in a way that keeps each record intact, and know how to recover when it goes wrong.

This is the error worth being genuinely careful about, because it is silent and often unrecoverable. Sorting one selected column reorders only that column. Every other column stays put, so the association between a name and its data is destroyed — and nothing on screen indicates anything is wrong.

The safe method is to click a single cell inside the data and use Data > Sort. Excel then detects the whole contiguous range and sorts complete rows, keeping records together. If a warning offers to 'Expand the selection,' always accept it — that dialog is Excel catching this exact mistake.

If you realize you have mis-sorted, press Ctrl+Z immediately and do nothing else first. Once you save and close, the original pairing is gone — there is no way to reconstruct which name belonged to which quantity. This is the strongest practical argument for storing working files in OneDrive, where version history can recover the previous state.
Add an index column numbered 1, 2, 3 before you start sorting a data set. Sorting by that column returns the sheet to its original order at any point, which turns an irreversible operation into a reversible one.

Understanding Sorting in Excel

Sorting reorganizes your dataset based on the values in one or more columns. Instead of manually rearranging rows, Excel automatically moves entire records together so your data remains aligned.

You can sort alphabetically, numerically, by date, or by a custom logical order such as T-shirt sizes.

Step 1: Select a Cell Inside Your Dataset

Before sorting, click anywhere inside your dataset. Excel will automatically detect the surrounding data range.

If you select only one column instead of the entire dataset, you risk misaligning rows and corrupting your data.

Selecting a cell inside the dataset

Step 2: Locate the Sort Commands

Sorting tools are located on the Data tab inside the Sort & Filter group.

Sort & Filter group on Data tab

There are two quick-sort buttons (A–Z and Z–A) and a full Sort button for advanced options.

Basic Sorting: A to Z

The A–Z button sorts text alphabetically (A to Z), numbers from smallest to largest, and dates from oldest to newest.

A to Z sorting command

After clicking A–Z, Excel reorganizes the entire dataset based on the selected column.

Dataset sorted A to Z

Basic Sorting: Z to A

The Z–A button reverses the order. It sorts text from Z to A, numbers from largest to smallest, and dates from newest to oldest.

This is useful when identifying top performers, highest values, or most recent entries.

Using the Sort Dialog for More Control

For advanced sorting, click the Sort button instead of the A–Z icons.

Sort command button

The Sort dialog box allows you to choose specific columns and define custom sorting rules.

Sort dialog box

If your dataset includes headers, ensure 'My data has headers' is checked so Excel recognizes column names.

Multi-Level Sorting

Multi-level sorting allows you to sort by more than one column. Excel sorts by the first column, then breaks ties using the second column.

For example, you could sort by Homeroom number first, then by Last Name.

Add Level in Sort dialog

Use Add Level to introduce another sorting rule. You can adjust priority using Move Up or Move Down.

Move Up and Move Down sorting levels
Multi-level sorted result

Sorting with Custom Lists

Alphabetical order is not always logical. For example, T-shirt sizes should follow Small, Medium, Large, X-Large — not alphabetical order.

To create a logical order, use Custom Lists.

Order dropdown showing Custom List option
Custom Lists dialog window

Enter your logical sequence (Small, Medium, Large, X-Large) and click Add.

Custom list selected
Dataset sorted using custom list

Knowledge Check

Check your understanding

What type of sort would you use to organize a list from A to Z?

Practice File

Download this file and follow along with the lesson.

Challenge

Apply what you've learned in this lesson.

Download and open the practice workbook provided for this lesson.

  1. Click the Challenge tab at the bottom of the workbook.
  2. For the main table, create a custom sort that sorts by Grade from Smallest to Largest and then by Camper Name from A to Z.
  3. Create a second sort for the Additional Information section. Sort by Counselor (Column H) from A to Z.
  4. Ensure the entire dataset moves together without misaligning rows.
  5. When finished, your workbook should match the example shown below.
Final sorted challenge result
Final result after applying multi-level sorting and sorting the Additional Information section.

Finished this lesson?

Progress is saved in this browser only. It is not a grade — official progress lives in Brightspace.