Sorting in Excel puts your data in a logical order—alphabetically, numerically, by date, or by color—so you can scan, analyze, and present it faster. The quickest way is to select any cell in your data range, go to the Data tab, and click the A→Z or Z→A button. But for multi-level sorts, custom lists, or sorting by row, you’ll need the full Sort dialog. This guide walks through every method, from one-click sorts to advanced options, with steps for Excel 365 on Windows (Mac differences noted).
What You’ll Need
- A computer with Microsoft Excel (Microsoft 365, Excel 2021, 2019, or 2016) installed. Steps are for Windows; Mac differences are noted.
- A worksheet containing data you want to sort—typically a table with column headers in the first row.
- Basic familiarity with selecting cells and using the ribbon.
Step-by-Step
Method 1: Quick Sort with One Click
- Open your Excel workbook and navigate to the sheet with the data.
- Click any single cell inside the data range. Excel will detect the entire contiguous block of data automatically. Do not select the entire column unless you want to sort only that column (which can break your data).
- Go to the Data tab on the ribbon.
- In the Sort & Filter group, click the A→Z button (for ascending sort: A to Z, smallest to largest, or oldest to newest) or the Z→A button (descending).
- Excel immediately sorts the entire data range based on the column where your active cell is located. For example, if you clicked a cell in column B, the sort will reorder rows by column B values.
- On a Mac, the buttons are in the same Data tab, labeled Sort Ascending and Sort Descending.
Method 2: Sort by Multiple Columns (Multi-Level Sort)
- Click any cell within your data range.
- Go to the Data tab and click Sort (in the Sort & Filter group). This opens the Sort dialog box.
- By default, the dialog shows one level. Under Column, choose the first column to sort by (e.g., “Last Name”).
- Under Sort On, keep “Cell Values” for standard sorts.
- Under Order, choose “A to Z” or “Z to A” (or “Smallest to Largest” for numbers).
- Click Add Level to add a second sort key. For example, after sorting by Last Name, add a second level for First Name.
- Repeat to add more levels as needed. Excel sorts by the first level first, then within ties, by the second level, and so on.
- If your data has headers, ensure the My data has headers checkbox is ticked. If not ticked, Excel treats the first row as data.
- Click OK to apply the sort.
Method 3: Sort by Row (Left-to-Right)
- Select the entire range you want to sort, including the rows that will be reordered. For example, if you have a summary table with months in row 1 and sales in row 2, select both rows.
- Go to the Data tab and click Sort.
- In the Sort dialog, click the Options button (bottom-left).
- Under Orientation, choose Sort left to right, then click OK.
- Now the dialog changes: the Column dropdown becomes a Row dropdown. Choose the row that contains the values you want to sort by (e.g., Row 1 for months).
- Set the Sort On and Order as usual (e.g., “Custom List” for months, or “Smallest to Largest” for numbers).
- Click OK. Excel will reorder the columns based on that row’s values.
Method 4: Sort by Cell Color, Font Color, or Icon
- Select any cell in your data range and open the Sort dialog (Data > Sort).
- Under Column, choose the column that has the colored cells.
- Under Sort On, select Cell Color, Font Color, or Cell Icon.
- In the Order area, the first dropdown lets you pick the specific color or icon. The second dropdown lets you choose where to place it (e.g., “On Top”).
- Add more levels if you have multiple colors to prioritize.
- Click OK.
Method 5: Sort Using a Custom List (e.g., Month Names, Weekdays)
- Open the Sort dialog (Data > Sort).
- Choose the column that contains the items (e.g., month names).
- Under Order, select Custom List… from the dropdown.
- In the Custom Lists dialog, select a built-in list (like “January, February, March…”) or create your own by typing entries in the List entries box, separated by commas, and clicking Add.
- Click OK twice to apply.
Common Mistakes
- Sorting only one column—selecting just column A and sorting will reorder that column independently, scrambling the rest of your data. Always select a single cell (or the entire range) so Excel keeps rows together.
- Forgetting to include all columns—if you manually select a range that misses a column, that column won’t move with the sort, breaking your data.
- Not checking the header checkbox—if your data has headers and you leave “My data has headers” unchecked, the header row will be sorted as data.
- Sorting with hidden rows/columns—hidden rows are included in the sort, which can produce unexpected results. Unhide before sorting if you want them to stay in place.
- Using the wrong orientation—if you intend to sort left-to-right but leave it on top-to-bottom, you’ll reorder rows instead of columns.
Tips
- Always make a backup copy of your workbook before sorting, especially if you have formulas that reference other cells. Sorting changes row positions, and formulas that don’t use absolute references may break.
- Use Excel Tables (Ctrl+T) for your data. Tables auto-expand when you sort, and the header row stays fixed. To sort a table, click any cell and use the same Data tab buttons.
- If you need to sort by a formula result, sort by the value that formula returns—Excel does that automatically.
- To sort by a custom order that isn’t alphabetical (like high/medium/low), create a custom list as shown in Method 5.
- On a Mac, the Sort dialog is similar, but the Options button is under a gear icon. Keyboard shortcuts: Windows: Alt+A+S+A (ascending), Alt+A+S+D (descending). Mac: Option+Command+Shift+A? Actually, use the ribbon buttons.
Troubleshooting
Sort doesn’t affect all columns. This usually means you selected only a partial range. Click any single cell in the data and try again. If you have blank columns or rows within your data, Excel may not detect the full range. Remove blank rows/columns or convert to a Table.
Header row gets sorted into the data. In the Sort dialog, ensure “My data has headers” is checked. If you used the quick sort buttons, Excel usually detects headers automatically, but if your header is formatted differently, it might not. Reapply with the dialog.
Sort order seems wrong (e.g., 10 comes before 2). This happens when numbers are stored as text. Select the column, go to Data > Text to Columns, and click Finish to convert text to numbers. Or use the warning icon that appears and choose “Convert to Number”.
Sorting breaks formulas. If formulas reference cells that moved, they may return wrong results. Use absolute references (e.g., $A$1) or better, use structured references in Tables. After sorting, double-check key formulas.
Custom list doesn’t appear. If you created a custom list but it’s not in the dropdown, ensure you clicked Add before OK. Also, the list must exactly match the cell values (including spaces).
Frequently Asked Questions
Q: Can I sort by multiple columns at once?
A: Yes. Use the Sort dialog and click “Add Level” for each additional column. Excel sorts by the first level, then within ties by the second, and so on.
Q: How do I sort by date in Excel?
A: Select a cell in the date column and use the A→Z (oldest to newest) or Z→A (newest to oldest) buttons. Ensure the dates are real date values, not text. If they’re text, convert them using DATEVALUE or Text to Columns.
Q: What is the difference between sorting and filtering?
A: Sorting reorders the rows permanently (until you sort again). Filtering temporarily hides rows that don’t match criteria, leaving the order unchanged. You can filter and then sort the visible rows.
Q: Can I sort a row instead of a column?
A: Yes. Use the Sort dialog, click Options, and choose “Sort left to right.” Then pick the row to sort by.
Q: Why does my sort not keep rows together?
A: This usually happens when you select only one column and sort it. Always click a single cell inside the data range, or select the entire range, before sorting.
Q: Can I sort by cell color in Excel?
A: Yes. Open the Sort dialog, set “Sort On” to “Cell Color”, then choose the color and whether it goes on top or bottom. You can add multiple levels for different colors.
Related
- Physics Wallah Balance Sheet: Key Financials
- Balloons with Metallic Numbers: Sizes, Filling, and Safety
- Split a String in BigQuery? SQL Methods
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Remove Spaces at the End of Text in Excel with TRIMTo remove ordinary spaces at the end of text in Excel, put =TRIM(A2) in a helper column if…
- How to Add a Formula in Excel for Addition: Simple StepsTo add numbers in Excel, select the cell where you want the answer, type a formula that starts…
- Excel Not Allowing Me to Drag a Formula? Try These FixesIf Excel will not let you drag a formula, turn on File > Options > Advanced, then under…
- Excel Greater Than and Less Than Formulas ExplainedIn Excel, use > to test whether a value is greater than another and < to test whether…
- Excel Conditional Formatting: Color Cells With a FormulaYes. In Excel for Microsoft 365 on Windows, select the cells to format, then choose Home > Conditional…
- Excel Formula for Quarterly Dates: Examples and TipsTo calculate the first day of the calendar quarter containing a date in A2, use =DATE(YEAR(A2),3*INT((MONTH(A2)-1)/3)+1,1). For example,…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.