Home life · Updated
How to Alphabetize Rows in Excel: Sort A to Z
Quick answer To alphabetize rows in Excel, select the data range, go to Data > Sort, choose the column to sort by, and pick A to Z. This rearranges entire rows so related information stays together.
What You’ll Need
- Microsoft Excel (desktop, web, or mobile)
- A spreadsheet with data organized in rows and columns
- At least one column containing text you want to sort alphabetically
Step-by-Step
- Select the data range – Click and drag to highlight all cells you want to sort, including the column headers. If your data is a proper Excel table (created with Ctrl+T), you can click anywhere inside it and Excel will automatically include the whole table.
- Open the Sort dialog – Go to the Data tab on the ribbon and click the “Sort” button (usually in the Sort & Filter group). In Excel for the web, the button is labeled “Sort” as well. You can also use the shortcut Alt+A+S (Windows) or Cmd+Shift+R (Mac) to open the dialog directly.
- Choose the column to sort by – In the Sort dialog, under “Column,” select the column that contains the text you want to alphabetize. If you included headers, make sure “My data has headers” is checked so the header row stays at the top.
- Set the sort order to A to Z – Under “Sort On,” keep “Cell Values.” Under “Order,” choose “A to Z.” This sorts alphabetically from A to Z; choose “Z to A” if you need reverse order.
- Add more levels if needed – If you have duplicate values in the first column, click “Add Level” to sort by a second column (e.g., last name, then first name). Repeat for as many levels as necessary.
- Apply the sort – Click “OK.” Excel will rearrange the entire rows based on the alphabetical order of the selected column, keeping each row’s data intact.
Common Mistakes
- Selecting only one column – If you highlight just the column you want to sort, Excel will sort that column alone, mixing up the rows. Always select the full range of data (all columns) before sorting.
- Forgetting to check “My data has headers” – If you skip this, Excel treats your header row as a regular data row and sorts it into the middle of your data.
- Hidden or blank rows – If some rows are hidden or contain blank cells, the sort may not behave as expected. Unhide all rows and fill in or remove blank rows before sorting.
- Sorting merged cells – Merged cells can cause errors or unpredictable results. Unmerge any cells in the sort range before sorting.
- Using the wrong sort option – The “Sort A to Z” button on the Home tab sorts only the selected column, not the whole row. Use the full Sort dialog to keep rows together.
Tips
- Use a table for safety – Convert your data to an Excel Table (Ctrl+T) before sorting. Tables automatically expand and keep formatting, and sorting inside a table always moves entire rows.
- Sort by multiple columns – For lists with repeated entries (like a contact list with same last names), add a secondary sort by first name to get a more useful order.
- Check for leading spaces – Extra spaces before text can make sorting appear wrong. Use the TRIM function or Find & Replace to remove leading spaces before sorting.
- Sort numbers and text separately – If your column has mixed numbers and text, Excel sorts numbers first, then text. Consider formatting the column consistently.
- Use the Undo shortcut – If the sort goes wrong, press Ctrl+Z (Cmd+Z on Mac) immediately to revert. This works even after multiple actions.
Troubleshooting
- Rows got mixed up – This happens when you selected only one column. Undo, then select the entire data range and redo the sort.
- Header row sorted into data – Check the “My data has headers” box in the Sort dialog. If you already sorted, undo and try again with the box checked.
- Sort order seems wrong – Excel sorts case-insensitively by default, but punctuation and symbols may appear before letters. Also check for hidden spaces or non-printing characters.
- Blank cells move to the bottom – That’s normal; Excel places blank cells at the end in an A to Z sort. If you need them elsewhere, fill them with a placeholder.
- Sort button is grayed out – This usually means your worksheet is protected or the range is not editable. Unprotect the sheet (Review > Unprotect Sheet) or check if cells are locked.
- Data with formulas – Sorting is fine, but formulas that reference other cells may update incorrectly. Double-check any formulas after sorting, especially if they use relative references.
Frequently Asked Questions
How do I alphabetize rows without mixing up the data?
Always select the entire data range (all columns) before sorting. Use the Sort dialog (Data > Sort) and choose the column to sort by. Excel will keep each row intact.
Can I sort by last name when the full name is in one column?
Yes. Use the “Sort by” column with the full name, then click “Options” and choose “Sort by last name” (available in desktop Excel). Alternatively, split the name into two columns using Text to Columns, then sort by the last name column.
Why does my sort put numbers before letters?
Excel sorts numbers before text in an A to Z sort. If you want a purely alphabetical order, convert numbers to text (e.g., format the column as text) or use a custom sort order.
How do I sort rows alphabetically in Excel online (web version)?
The steps are the same: select the data, go to Data > Sort, choose the column and A to Z. The web version may have a slightly different interface, but the Sort dialog works similarly.
What if my data has a header row that I don’t want to move?
Check “My data has headers” in the Sort dialog. Excel will keep the first row fixed and sort the rest.
Can I sort alphabetically by more than one column?
Yes, in the Sort dialog click “Add Level” to add additional columns. Specify each column and its sort order (A to Z or Z to A).
Related
- How to Organize Dates in Excel
- How to Organize Data by Date in Excel
- How to Sort Cells Alphabetically in Excel
Sources: Microsoft Support. Menus and buttons can differ slightly by version. Spotted something out of date? Tell us.