Home › Excel basics › Sort & filter
How to Sort and Filter Data in Excel
Sorting puts rows in order; filtering hides the rows you don't need. Together they're the fastest way to make sense of a long list, and neither needs a formula.
In this guide
Quick sort on one column
- Click any cell in the column you want to sort by. Don't select the column itself.
- Go to Data and click A→Z (smallest to largest) or Z→A (largest to smallest).
Excel sorts the whole table and keeps each row together. If you select just one column and see a "Sort Warning", choose Expand the selection. Otherwise only that column moves and your rows get mixed up.
Sort by several columns
To sort by region first and then by sales within each region:
- Click inside the data and go to Data › Sort.
- Check "My data has headers".
- Sort by Region, A to Z.
- Click Add Level, then by Sales, Largest to Smallest.
The same dialog can sort by cell color or font color, and by a custom order (like High, Medium, Low) via Order › Custom List.
Filter with AutoFilter
- Click inside the data and press Ctrl+Shift+L (or Data › Filter). Arrows appear in the header row.
- Click the arrow in a column and untick the values you want to hide, or use the search box.
- Text Filters: contains, begins with, does not equal. Wildcards work here: see wildcards.
- Number Filters: greater than, between, top 10, above average.
- Date Filters: this month, last quarter, a custom range.
- Filter by Color: useful together with conditional formatting.
Filters in several columns combine: Region = North and Sales > 1000. Clear them with Data › Clear, or press Ctrl+Shift+L again to remove the filter arrows.
Totals for the visible rows only: SUM keeps adding hidden rows. Use =SUBTOTAL(109, C2:C100) to sum only what's visible. See SUBTOTAL.
Live results with SORT and FILTER
In Microsoft 365 and Excel 2021+, you can create a sorted or filtered copy that updates automatically:
=SORT(A2:C100, 3, -1)sorts by the 3rd column, largest first.=SORTBY(A2:C100, B2:B100, 1, C2:C100, -1)sorts by column B, then C descending.=FILTER(A2:C100, A2:A100="North")returns only North rows. See FILTER.
Tips for clean sorting and filtering
- Keep one header row and no empty rows or columns inside the data.
- Turn the range into a table with Ctrl+T: filters are added automatically and new rows are included.
- Numbers stored as text sort in the wrong order (1, 10, 2). Convert them to real numbers first.
- Freeze the header row so it stays visible while scrolling: see freeze panes.
Frequently asked questions
Why does sorting mess up my data?
Only one column was selected and sorted. Undo with Ctrl+Z, click a single cell instead, and sort again so Excel expands the selection to the whole table.
Why are some rows not included in the filter?
There's an empty row in your data, and Excel stopped the range there. Remove empty rows, or select the full range before turning on the filter.
What is the shortcut for filter in Excel?
Ctrl+Shift+L on Windows and Cmd+Shift+F on a Mac turn the filter on and off.