Excel Lesson 8 – Sort & Filter | Dataplexa
Lesson 8 · Basics Practical

Sort & Filter

Real datasets are rarely in the order you need them. You might have 500 rows of sales transactions mixed across regions, dates, and products — and you need to find the top performers, isolate one region, or sort everything by date. Sort and Filter are the tools that let you reorganise and slice your data instantly without changing or deleting anything. They are two of the most-used features in all of Excel.

Sorting Data

Sorting rearranges the rows in your data based on the values in one or more columns. The rows stay together — the whole row moves, not just the column you are sorting by. So if you sort a sales table by region, every row shifts so that all the North rows are grouped together, all the South rows together, and so on — with each row's sales figures, dates, and other data still attached correctly.

The quickest way to sort is to click anywhere inside the column you want to sort by, then use the sort buttons in the Data tab or the Home tab → Sort & Filter dropdown:

A→Z
Sort Ascending
Smallest → Largest
A → Z
Oldest → Newest
Z→A
Sort Descending
Largest → Smallest
Z → A
Newest → Oldest
Custom Sort
Multiple levels
Sort by 2+ columns
at the same time

Single-Column Sort

Let's start with a sales dataset and sort it by Total Sales, highest to lowest, so the best-performing rows rise to the top. Here is the data before sorting:

Before Sort — Unsorted Sales Data
Sales Rep Region Q1 Sales Q2 Sales Total
MariaSouth38,00044,00082,000
JamesEast55,00062,000117,000
SarahNorth42,00051,00093,000
DavidWest47,00053,000100,000
PriyaNorth61,00058,000119,000

Click anywhere in the Total column → Data tab → Z→A (largest to smallest).

After Sort — Ranked Highest to Lowest by Total
Sales Rep Region Q1 Sales Q2 Sales Total ↓
PriyaNorth61,00058,000119,000
JamesEast55,00062,000117,000
DavidWest47,00053,000100,000
SarahNorth42,00051,00093,000
MariaSouth38,00044,00082,000

Notice that the entire row moved — Priya's Q1 and Q2 figures stayed attached to her name. The data is intact, just reordered.

Multi-Level Sort — Custom Sort

Sometimes a single sort level is not enough. Imagine you want to sort first by Region (A to Z), and then within each region, sort by Total Sales (highest to lowest). That requires two sort levels, which you set up using the Custom Sort dialog.

Go to Data → Sort to open it. You can add as many sort levels as you need using the Add Level button. The order of the levels matters — Excel sorts by the first level first, then breaks ties using the second level, and so on.

Sort
+ Add Level Delete Level
Column
Sort On
Order
Level 1
Region ▾
Cell Values ▾
A to Z ▾
Level 2
Total ▾
Cell Values ▾
Largest to Smallest ▾
OK
Cancel

Introducing AutoFilter

Sorting changes the order of your data. Filtering is different — it hides rows that do not match your criteria. The data is still there, just temporarily invisible, and you can bring it back anytime by clearing the filter.

The easiest way to enable filtering is to click anywhere in your data and press Ctrl + Shift + L, or go to Data → Filter. This adds a small dropdown arrow to every header cell. Click an arrow to open that column's filter options.

AutoFilter Dropdowns on Headers
Sales Rep ▾ Region ▾ Q1 Sales ▾ Q2 Sales ▾ Total ▾
PriyaNorth61,00058,000119,000
JamesEast55,00062,000117,000
DavidWest47,00053,000100,000
SarahNorth42,00051,00093,000
MariaSouth38,00044,00082,000

Using Filter Dropdowns

When you click a filter dropdown arrow, you see a list of all the unique values in that column with checkboxes. Unticking a value hides all rows containing it. You can tick and untick as many values as you like. A small funnel icon appears on the dropdown arrow to show that a filter is active on that column.

Let's say we click the Region dropdown and untick everything except North. Only the North rows are visible — rows 2 and 5 in the original data. The row numbers in Excel turn blue to signal that rows are hidden, not deleted.

Filter Dropdown — Region
Region ▾
🔍 Search...
☐ (Select All)
☐ East
☑ North
☐ South
☐ West
OK
Cancel
Result — Only North Rows Visible
Sales Rep Region 🔽 Total
2 Priya — North 119,000
4 Sarah — North 93,000
Rows 1, 3, 5 are hidden — not deleted

To clear a filter from one column, click its dropdown and choose Clear Filter From "Region". To clear all filters at once, go to Data → Clear. To turn off AutoFilter completely and remove all the dropdown arrows, press Ctrl + Shift + L again.

Number Filters and Text Filters

The checkbox list works well for text columns with a small number of unique values. But when a column contains numbers or dates, the dropdown also offers Number Filters (or Date Filters) with more powerful options — like showing only rows where Total is greater than 100,000, or between 50,000 and 120,000.

Filter Options by Column Type
Number Filters
Equals / Does Not Equal
Greater Than
Less Than
Between
Top 10 (by value or %)
Above / Below Average
Text Filters
Equals
Contains
Does Not Contain
Begins With
Ends With
Custom Filter
Date Filters
Yesterday / Today / Tomorrow
This Week / Last Week
This Month / Last Month
This Quarter / This Year
Before / After
Between

Filtering Across Multiple Columns

You can apply filters on multiple columns at the same time — the filters work together as AND conditions. So if you filter Region to show only North AND filter Total to show only values above 100,000, you see only rows that satisfy both conditions simultaneously.

Filter 1: Region = North
Filter 2: Total > 100,000

Result:   Only Priya (North, $119,000) is visible
          Sarah (North, $93,000) is hidden — Total does not exceed 100,000
1 row visible — Priya | North | $119,000

The SUBTOTAL Function with Filters

Here is something important to know. If you have a SUM formula at the bottom of a column and you apply a filter, the SUM still includes the hidden rows. It does not adjust to show only the visible rows.

The solution is the SUBTOTAL function. Unlike SUM, SUBTOTAL automatically ignores hidden rows — so when you filter your data, the total at the bottom updates to reflect only what is visible.

=SUBTOTAL(9, B2:B100)     9 = SUM of visible rows only
=SUBTOTAL(1, B2:B100)     1 = AVERAGE of visible rows only
=SUBTOTAL(2, B2:B100)     2 = COUNT of visible rows only
With North filter active → SUBTOTAL(9) shows 212,000 (Priya 119K + Sarah 93K only)

When you use Format as Table (from Lesson 6), Excel automatically adds a SUBTOTAL-powered Total Row for you. That is one more reason to use Excel Tables for your data.

Sort and Filter Shortcuts

Ctrl + Shift + L
Toggle AutoFilter on and off — adds or removes the dropdown arrows.
Alt + Down Arrow
Open the filter dropdown for the active header cell without using the mouse.
Data → Clear
Clear all active filters and show all rows again — does not remove the filter arrows.
Data → Reapply
Refreshes your current filters after you have added or edited data — useful if rows are not updating correctly.
💡 Teacher's Note
The single most important thing to remember about filtering is that it hides rows — it does not delete them. This trips people up all the time. They filter down to 10 rows, copy something, then paste it somewhere and wonder why they have 500 rows of data they did not expect. Always be aware of whether you are working with filtered data, and use SUBTOTAL instead of SUM whenever filters might be involved.

🟠 Practice

Q1. You want to sort your data by Region A to Z, and within each region by Sales highest to lowest. How many sort levels do you need, and where do you set this up?




Q2. You apply a filter and notice the row numbers down the left side have turned blue. What does this mean?




Q3. You have a SUM formula at the bottom of a filtered column, but it is including hidden rows in the total. Which function should you use instead?



🟣 Quiz

Q1. You sort a table by the Total column, largest to smallest. What happens to the other columns in each row?







Q2. What does pressing Ctrl + Shift + L do when you already have AutoFilter active on your data?







Q3. You filter Region to North, and filter Total to values above 100,000. You have five rows of data — two are North, one of which has a Total above 100,000. How many rows are visible?






Next up — Find & Replace, where you will learn how to locate any value in your workbook instantly and make bulk changes across thousands of cells in seconds.