Appearance
How to Sort and Filter Data in Excel
Estimated Time to Fix: 3 minutesApplies to: Microsoft Excel (Microsoft 365, Excel 2021, Excel 2019, Excel for the web)
Article Type: How-To
Last Updated: 2026-07-16
Summary
Sort data alphabetically or by value and use filters to show only the rows you need. Sorting rearranges your data; filtering hides rows that don't match your criteria without deleting them.
Prerequisites
- Microsoft Excel (desktop or web).
- A spreadsheet with data in rows and columns (headers in the first row work best).
Instructions
1. Sort Data by a Single Column
Arrange your data alphabetically, numerically, or by date.
- Click any cell in the column you want to sort by.
- Go to the Data tab on the ribbon.
- Click Sort A to Z (↑ ascending) or Sort Z to A (↓ descending).
- For numbers, these become Smallest to Largest and Largest to Smallest.
- For dates, they become Oldest to Newest and Newest to Oldest.
- The entire table rearranges based on that column.
TIP
Excel moves entire rows together when sorting — your data stays intact. If you accidentally scramble something, press Ctrl + Z immediately to undo.
2. Sort by Multiple Columns
Sort by one column first, then by another within those groups.
- Click any cell in your data.
- Go to the Data tab and click Sort.
- In the Sort dialog, set the first sort level (for example: Sort by = Department, Order = A to Z).
- Click Add Level to add a second sort (for example: Then by = Last Name, Order = A to Z).
- Click OK.
The data is sorted by department first, then alphabetically by last name within each department.
3. Add Filters to Your Data
Add dropdown arrows to column headers so you can show or hide specific rows.
- Click any cell in your data.
- Go to the Data tab and click Filter (or press Ctrl + Shift + L).
- Dropdown arrows (▼) appear on every column header.
- Click the dropdown arrow on the column you want to filter.
- Uncheck Select All, then check only the values you want to see.
- Click OK.
Only the matching rows are displayed. The other rows are hidden (not deleted) — you can bring them back at any time.
If you find yourself switching filters on for the same data every time you open the file, convert the range into a table instead: press Ctrl + T and the filter buttons become permanent, the header row stays visible while you scroll, and new rows are included automatically. See How to Format Data as a Table in Excel.
4. Use Text and Number Filters
Apply more specific filter conditions beyond simple checkbox selection.
- Click the filter dropdown arrow on a column.
- Hover over Text Filters (for text columns) or Number Filters (for number columns).
- Select a condition like Contains, Greater Than, Between, or Top 10.
- Enter the criteria and click OK.
Only rows matching the condition are shown.
TIP
Date filters are especially powerful — you can filter by this week, last month, this quarter, or a custom date range. Click the filter dropdown on a date column and hover over Date Filters to see all options.
5. Clear Filters
Remove filters to see all your data again.
- Go to the Data tab and click Clear (next to the Filter button). All hidden rows reappear.
- To remove the filter dropdowns entirely, click Filter again (or press Ctrl + Shift + L).
Troubleshooting
WARNING
If your formulas (like SUM or AVERAGE) give unexpected results after filtering, they may be including hidden rows. Use SUBTOTAL instead of SUM — =SUBTOTAL(109, A2:A100) sums only visible rows.
| Symptom / Error | Potential Cause | Solution |
|---|---|---|
| Sort rearranges some rows but not others | Data has blank rows in the middle | Remove blank rows so Excel recognizes the data as one continuous table. |
| Filter dropdown shows only a few values | Another filter is already active on a different column | Click Data > Clear to remove all filters first, then re-apply. |
| Sorting mixes up data across columns | Excel selected only one column instead of the full table | Press Ctrl + Z to undo. Select the entire data range before sorting, or convert it to a Table first (Ctrl + T). |
This operation requires the merged cells to be identically sized | Merged cells inside the sort range | Sorting moves whole rows, and a merged block spans rows that cannot move independently. Unmerge the range first — see How to Wrap Text and Merge Cells in Excel. |
| Filter arrows don't appear on header row | First row not recognized as headers | Go to Data > Sort and check My data has headers in the dialog. |
| Numbers sort as text (1, 10, 2, 20...) | Column formatted as text instead of number | Changing the format alone does not re-read the existing values — see How to Fix Numbers Stored as Text in Excel. |
Related Articles
- How to Format Data as a Table in Excel
- How to Fix Numbers Stored as Text in Excel
- How to Remove Duplicate Rows in Excel
- How to Wrap Text and Merge Cells in Excel
- How to Use Conditional Formatting in Excel
- How to Create a PivotTable in Excel
- How to Freeze Panes and Split Views in Excel
- Understanding Excel Features — A Quick-Reference Guide