How To Alphabetize In Excel
A practical step-by-step guide to how to alphabetize in excel, including preparation, instructions, common issues, tips, and next steps.
How To Alphabetize In Excel
Learning how to alphabetize in Excel is a fundamental skill for anyone working with data. Whether you have a simple list of names or a complex table of sales figures, sorting your information makes it easier to read, analyse, and find what you need. This guide will walk you through everything from a simple A-to-Z sort to more advanced techniques like sorting by multiple columns or even by colour. We'll cover the essential steps to sort your data accurately without scrambling your rows, helping you keep your spreadsheets tidy and effective.
Fast Answer
- Select Cell: Click any cell inside the column you wish to sort.
- Go to Data Tab: Navigate to the Data tab on the Excel ribbon.
- Click Sort Icon: Click the A-Z icon to sort ascending or the Z-A icon to sort descending.
- Expand Selection: If prompted, always choose 'Expand the selection' to keep your rows intact.
Before You Start
- Microsoft Excel: You will need a working copy of Microsoft Excel installed on your computer. These steps apply to most modern versions, including Excel for Microsoft 365, Excel 2021, 2019, and 2016 for both Windows and Mac.
- Your Data Table: Have your spreadsheet ready. For best results, your data should be in a table format with a clear header row at the top (e.g., 'First Name', 'Last Name', 'Email').
- Backup Your Data (Recommended): If you are working with critical information, it's a wise precaution to save a copy of your file before you begin. You can do this via File > Save a Copy. A sort can be undone immediately, but not after other changes are made.
Step-by-Step Instructions
Prepare Your Data for a Flawless Sort
Before you even click the sort button, a little preparation ensures Excel understands your data correctly. Your data should be arranged in a simple table format. This means having your column titles in the very first row, with the data for each record filling the rows below. Avoid having any completely blank rows or columns in the middle of your dataset, as this can cause Excel to mistake where your table ends.
A good way to check what Excel sees as your data range is to click any single cell within your table and press Ctrl + A on Windows or Cmd + A on a Mac. Excel will highlight the entire continuous block of data it intends to work with. If it doesn't select all your data, you likely have a blank row or column that needs to be removed.
Perform a Simple A-Z or Z-A Sort
This is the quickest way to alphabetize your data based on the contents of a single column. Let's say you have a list of employees and want to sort them alphabetically by their last name.
- Click on any single cell within the 'Last Name' column. You do not need to highlight the entire column.
- Navigate to the Data tab at the top of the Excel window.
- In the 'Sort & Filter' section of the ribbon, you will see two prominent icons: one with an 'A' above a 'Z' and a down arrow (A-Z Sort Ascending), and another with a 'Z' above an 'A' (Z-A Sort Descending).
- Click the A-Z icon. Excel will instantly reorder your entire table, arranging the rows alphabetically from A to Z based on the last names.
To sort in the opposite direction (Z to A), simply click the Z-A icon instead. This method is also useful for sorting numbers from smallest to largest (A-Z) or largest to smallest (Z-A), and dates from oldest to newest (A-Z) or newest to oldest (Z-A).
Use the Main 'Sort' Dialogue Box for More Control
While the quick sort buttons are great, the main Sort dialogue box gives you much more power and clarity, especially for complex data. It is the safest way to ensure your sort is configured correctly.
- Click on any cell inside your data table.
- Go to the Data tab on the ribbon.
- Click the large Sort button (it usually has A-Z and a funnel icon). This opens the Sort dialogue box.
Inside this box, you'll see several important options. The most critical one is the checkbox at the top right: 'My data has headers'. Make sure this is ticked. This tells Excel to exclude your top row from the sorting process, so your column titles stay in place. The main dropdown menus allow you to choose which column to 'Sort by', what to 'Sort On' (usually 'Values'), and the 'Order' (A to Z, Z to A, or a custom list).
Alphabetize by Multiple Columns (Multi-Level Sorting)
Often, you'll need to sort by more than one criterion. For instance, you might want to sort a list of employees first by their department, and then alphabetically by last name within each department. This is called a multi-level sort.
- Open the main Sort dialogue box (Data > Sort).
- Set up your first sorting level. In the 'Sort by' dropdown, select the first column you want to sort by, such as 'Department'. Set the order to A to Z.
- Now, click the 'Add Level' button in the top left of the dialogue box. A new row of sorting options will appear below the first.
- In this second level, the label will say 'Then by'. From its dropdown menu, select your second criterion, such as 'Last Name'. Set the order to A to Z.
- Click OK.
Excel will now execute the sort. It first organises all the rows based on the Department column. Then, for all the rows that share the same department, it will sort them based on the Last Name column. You can add many levels to create highly specific and organised views of your data.
Sort by a Custom List (Non-Alphabetical Order)
What if you need to sort by a logic that isn't alphabetical or numerical? For example, you might have a 'Priority' column with values like 'High', 'Medium', and 'Low', and you want to see the 'High' priority items first. An A-Z sort would incorrectly place 'High' before 'Low'. This is where custom lists are invaluable.
- Open the Sort dialogue box.
- In the 'Sort by' dropdown, choose your column, for example, 'Priority'.
- In the 'Order' dropdown on the far right, select 'Custom List...'.
- A 'Custom Lists' window will appear. On the left, you can choose from built-in lists like days of the week or months. To create your own, select 'NEW LIST'.
- In the 'List entries' box on the right, type your desired sort order, pressing Enter after each item. For our example, you would type:
High
Medium
Low - Click the 'Add' button, and your new list will appear on the left. Click OK.
- Back in the Sort dialogue box, your new custom order will be selected. Click OK to apply the sort. Your data will now be correctly ordered by your defined priority.
Sort from Left to Right (Sorting by Columns)
While most sorting is done top-to-bottom (by rows), you may occasionally need to sort your data from left-to-right (by columns). Imagine you have a table where row 1 contains months of the year, and you want to arrange the columns so the months are in alphabetical order.
- Open the main Sort dialogue box (Data > Sort).
- Click the 'Options...' button.
- In the 'Orientation' section, change the selection from 'Sort top to bottom' to 'Sort left to right'. Click OK.
- The dialogue box will now look different. Instead of 'Column', the label will say 'Row'. In the 'Sort by' dropdown, select the row that contains the values you want to sort by (e.g., Row 1 for your month headers).
- Choose your order (e.g., A to Z) and click OK.
Excel will rearrange the columns of your entire table based on the alphabetical order of the values in Row 1, while keeping the data within each column together.
Quick Reference
| Situation | Use this | Why |
|---|---|---|
| Quickly sort a list by a single column | Data > A-Z / Z-A buttons | This is the fastest method for simple, one-click sorting. |
| Sort by department, then by last name | Data > Sort > Add Level | Multi-level sorting organises data hierarchically for better analysis. |
| Sort by priority (e.g., High, Medium, Low) | Data > Sort > Order > Custom List | Allows you to define a logical order that isn't alphabetical or numerical. |
| Your data rows get scrambled after sorting | Undo (Ctrl+Z) and re-sort | You likely sorted only one column. Always let Excel 'Expand the selection' to keep rows intact. |
| Numbers aren't sorting correctly (10 before 2) | Home > Number Format > Convert to Number | This happens when numbers are stored as text. Converting them fixes the sort order. |
Common Problems When You Alphabetize In Excel
My data got scrambled! Only one column was sorted.
Cause: This is the most frequent sorting error. It happens when you manually highlight a single column and then, in the 'Sort Warning' box, you choose 'Continue with the current selection'. This tells Excel to ignore all other columns, breaking the connection between the data in each row.
Solution: The moment you notice this, press Ctrl + Z (Windows) or Cmd + Z (Mac) to undo the sort. To sort correctly, either click just one cell in the column you want to sort by (don't highlight the whole column) or, if you get the warning pop-up, always select 'Expand the selection'.
My column titles (headers) were sorted along with my data.
Cause: This occurs when Excel doesn't recognise that your first row contains headers. It can happen if you have a blank row between your headers and your data, or if you used the main Sort dialogue box and left the 'My data has headers' option unticked.
Solution: Undo the sort immediately. First, ensure there are no blank rows below your header row. Then, perform the sort again using the Data > Sort dialogue box and double-check that the 'My data has headers' box is ticked before you click OK.
Numbers are not sorting in the right order (e.g., 11 comes before 2).
Cause: This is a classic sign that your numbers are formatted as text. When numbers are stored as text, Excel sorts them character by character from left to right, just like words. So, it sees the '1' in '11' and places it before the '2'.
Solution: You need to convert the text back to numbers. Select the entire column. Go to the Home tab. In the 'Number' section, change the format from 'Text' or 'General' to 'Number'. You might also see a small green triangle in the corner of the cells; clicking the warning icon that appears gives you an option to 'Convert to Number'.
Advanced Tips for Alphabetizing in Excel
Perform a Case-Sensitive Sort
By default, Excel's sort function is not case-sensitive, meaning it treats 'apple' and 'Apple' as identical. If you need to distinguish between uppercase and lowercase text, you can enable case-sensitive sorting. In the main Sort dialogue box (Data > Sort), click the 'Options...' button. In the small window that appears, tick the 'Case sensitive' checkbox and click OK. Now, when you sort A to Z, Excel will place entries starting with uppercase letters before those starting with lowercase letters (e.g., 'UK' would come before 'united').
Sort by Cell Colour or Font Colour
If you use conditional formatting or manually colour-code your cells to signify status, you can sort your data based on those colours. Open the Sort dialogue box. Choose the column that contains the colours. In the 'Sort On' dropdown, change the selection from 'Values' to 'Cell Color' or 'Font Color'. A new dropdown will appear, allowing you to select which colour you want to sort by. You can then choose to place rows with that colour 'On Top' or 'On Bottom' of your list. You can even 'Add Level' to sort by multiple colours sequentially.
Create a Helper Column for Complex Sorting
Sometimes, the information you want to sort by isn't neatly contained in its own column. A common example is trying to sort by last name when you only have a 'Full Name' column. The solution is to create a temporary 'helper column'. Insert a new column next to your full names. Use an Excel formula to extract just the last name. For a name in cell A2, a formula like =RIGHT(A2,LEN(A2)-FIND(" ",A2)) can often work. Once you've copied this formula down the entire column, you can then perform a simple A-Z sort on your new 'Last Name' helper column.
How To Alphabetize In Excel FAQ
How do I alphabetize by last name in Excel?
If you have separate 'First Name' and 'Last Name' columns, simply click any cell in the 'Last Name' column and use the Data > A-Z sort button. If names are combined in a single 'Full Name' column, you should first split them. Use the 'Text to Columns' tool (found on the Data tab) to separate the names into two columns based on the space character. Then you can easily sort by the new last name column.
Can I alphabetize just one column without affecting the others?
You can, but you should do so with extreme caution as it will almost certainly corrupt your data's integrity. It breaks the relationship between data points in a row. To do it, highlight only the specific range of cells in the single column you want to sort. When you click sort, Excel will show a 'Sort Warning'. Choose 'Continue with the current selection'. This is only advisable for a standalone list that has no related data in adjacent columns.
How do I undo a sort in Excel?
The easiest way to undo a sort is to press Ctrl + Z (Windows) or Cmd + Z (Mac) immediately after you perform it. This will revert the data to its previous state. However, the undo history in Excel is limited. If you perform several other actions or save, close, and re-open the file, you will not be able to undo the sort. For vital data, it's wise to add an 'index' column with a simple number sequence (1, 2, 3...) before you start sorting. This way, you can always sort by the index column to return the data to its original order.
Why are my A-Z and Z-A buttons greyed out?
The sort buttons can become inactive for a few common reasons. The most likely is that you are currently editing a cell—press Enter or Escape to exit cell editing mode. It can also happen if you have multiple worksheets selected at the same time (they are 'grouped'). Right-click on one of the sheet tabs at the bottom and choose 'Ungroup Sheets'. Finally, the worksheet might be protected. Go to the Review tab and look for an 'Unprotect Sheet' button.
Final Checklist for Alphabetizing in Excel
- Data is Clean: Confirm your data is in a table with a single header row and no stray blank rows or columns.
- Backup Made: For important files, save a copy before you begin sorting.
- Goal Defined: Decide if you need a simple one-column sort or a more complex multi-level sort.
- Selection is Correct: Click a single cell within your data range before sorting. Avoid highlighting just one column unless that's your specific, cautious intent.
- Headers are Safe: If using the main Sort dialogue, always ensure the 'My data has headers' box is ticked.
- Expansion Confirmed: If you see a 'Sort Warning' pop-up, always choose 'Expand the selection' to keep rows together.
- Results Verified: After sorting, quickly scan your data to ensure it is organised as you expected and that rows are still intact.