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.
Sort by date
Click a cell in the date column and use the same A→Z button on the Data tab: for dates it sorts from oldest to newest, and Z→A from newest to oldest.
Does the order look random, with 10/2/2025 above 2/1/2026? Then the dates are stored as text and Excel sorts them by their first characters. Check with =ISNUMBER(A2): a real date gives TRUE. To convert a whole column, select it and choose Data › Text to Columns › Finish, then sort again.
To sort birthdays by month and day regardless of the year, add a helper column with =MONTH(A2)*100+DAY(A2) (3 May becomes 503) and sort on that column.
Sort columns from left to right
Excel normally sorts rows. To put columns in order instead, for example products or months across the top:
- Select the columns you want to reorder, including the header row. Leave out a column with row labels, or it moves along.
- Go to Data › Sort and click Options.
- Under Orientation, choose Sort left to right and click OK.
- At Sort by, choose Row 1 (or the row with the values to sort on) and click OK.
This doesn't work inside an Excel table: convert it first with Table Design › Convert to Range.
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.
Try it yourself: click a cell in the Sales column, choose Data › Sort Z to A, then Data › Filter and use the arrow in the Team heading to show only Marketing. Turn on JavaScript to practise this in an interactive Excel window.
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.
Keep learning
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.
Can Excel sort automatically when the data changes?
A normal sort is a one-off: new or changed values stay where they are. With the filter arrows on, click Data › Reapply (Ctrl+Alt+L) after a change to repeat the sort and the filters. Want a list that always stays sorted? Put =SORT(A2:C100, 3, -1) in an empty area; that copy updates by itself.
How do I get the original order back after sorting?
Right after sorting, Ctrl+Z works. Later on, only if you planned for it: before sorting, add a column with 1, 2, 3… (quick with AutoFill) and sort on that column to return to the original order.
Can I sort case-sensitively?
Yes. In Data › Sort, click Options and tick Case sensitive. In ascending order "apple" then comes before "Apple"; without that option Excel treats them as the same.