How to Sort Names in Excel Alphabetically

Formulas & functions · Updated November 20, 2026

To sort names alphabetically in Excel for Microsoft 365 on Windows, select the name list and any related columns, then choose Data > Sort and set the name column to Values and A to Z. Include the whole table so each person stays matched with their other information. Before sorting, check that the list has one name per row and that you know whether to sort full names by first name or by a separate last-name column.

What You’ll Need

  • An Excel workbook containing names, with one name in each row.
  • If the names belong with other details, such as email addresses or departments, include those columns in the data range you sort.
  • A clear header row, if your list has one. Headers might be Name, First Name, and Last Name.
  • For an important or shared list, save a copy of the workbook first. Sorting changes the order of rows, although you can usually undo it immediately with Ctrl+Z.

Step-by-Step

  1. Check how the names are arranged. Make sure each record occupies one row, with a person’s name in one cell or in clearly labeled first-name and last-name columns. Look for blank rows or columns inside the list; these can make Excel treat part of the data as a separate block. If the list has a header, keep it in the top row and make its label distinct from the names below it. For example, use Name as the header rather than putting an actual person’s name in the first row.
  2. Decide which field should determine the order. A single full-name column, such as Alex Chen, is sorted by the text at the start of each cell, so it will ordinarily be ordered by first name. If the list has separate Last Name and First Name columns and you want a conventional surname-first directory, sort by Last Name. You can then add First Name as a second sort level to order people with the same surname.
  3. Select the complete data range. Click a cell in the list, then select all the rows and columns that make up the records, including the header row when there is one. You can drag across the range, or click the first cell and Shift-click the last cell. For a continuous, neatly arranged block, clicking inside it and choosing Data > Sort is often enough: Excel can identify the adjacent data. Still, check the range shown in the Sort dialog, especially if there are blank rows, blank columns, or other material nearby. Do not select just the name cells if other columns contain information for the same people.
  4. Open the full Sort dialog. On the ribbon, choose Data > Sort. In the Sort dialog, confirm that My data has headers is checked if your selection includes a header row. Leave it unchecked if the selected range contains names only and no header. This setting tells Excel whether the first row is a label or a record; choosing incorrectly can leave the first name unsorted or move a heading into the list.
  5. Set the alphabetical sort. In Sort by, select the column that contains the names, or select Last Name if that is the intended sort key. Set Sort On to Cell Values and Order to A to Z. These settings put text in ascending alphabetical order. If the dialog labels the column by its header, choose the header name rather than relying on a column letter that may be unclear. Click OK to apply the sort.
  6. Add a second level when needed. If the names are in separate columns and two or more people share a surname, choose Data > Sort, then select Add Level. Set the first level to Last Name, Values, A to Z, and the next level to First Name, Values, A to Z. Click OK. Excel sorts by the surname first and uses the first name to order records within each surname. If you have only a single full-name column, a second level cannot reliably sort by surname because the first and last names are not separate fields.
  7. Review the result and related data. Scan the beginning, middle, and end of the sorted list to make sure the order is sensible. Check a few records against their email addresses or other details to confirm that complete rows moved together. If the order is wrong, use Ctrl+Z on Windows right away, check the chosen column and header setting, and sort again. On Mac, use Command+Z to undo. If the workbook is open in Excel for the web, the Data tab also provides sorting options; the dialog layout can differ slightly from the Windows desktop app.

For a simple list with no related columns, Excel also offers quick sorting: click a name cell and choose Data > Sort A to Z. Use this only after checking that Excel has identified the entire list. If a prompt asks whether to Expand the selection or Continue with the current selection, choose Expand the selection when adjacent columns are part of the same records. Choosing Continue with the current selection sorts only the highlighted cells and can mismatch the names and details beside them.

Common Mistakes

  • Sorting only one column in a multi-column list. This can pair each name with another person’s email, phone number, or other details. Select the entire table or choose Expand the selection when Excel prompts you.
  • Including a heading but not identifying it as a header. Excel may sort the heading among the names. In the Sort dialog, check My data has headers when appropriate. If there is no header, do not check it.
  • Expecting full names to sort by surname. A cell containing Priya Shah is sorted using the text at the start of the cell, not by Shah. Use a separate Last Name column as the sort key if you need a surname-first directory.
  • Leaving inconsistent spacing or spelling. Extra spaces, inconsistent use of hyphens, and spelling variations can make entries appear out of place. Inspect unusual entries before sorting; alphabetizing cannot correct the underlying text.
  • Sorting a partial range by accident. A blank row or column can separate one set of records from another, and an incomplete selection can leave some rows behind. Check the selection or the range displayed in the Sort dialog before confirming.
  • Using the quick sort without checking adjacent data. Quick sorting is convenient, but the full Sort dialog gives you a chance to verify the column, header setting, and range. Prefer it for a valuable or complex table.

Tips

  • Turn a recurring list into an Excel table. Select the data and choose Insert > Table, confirm whether the table has headers, and click OK. Tables make it easier to recognize a structured set of records and provide sort controls in the header row. Keep every person’s details in the same table row.
  • Keep first and last names in separate columns when practical. This makes it straightforward to sort by surname, then first name, and helps when you need other views of the same directory. Use clear column headings so the sort settings are easy to understand.
  • Use the full Sort dialog for multi-level sorting. Choose Data > Sort and Add Level to specify a primary and secondary field. The first level controls the main order; later levels break ties within matching values in the preceding level.
  • Save before making a large change. Ctrl+S saves on Windows; Command+S saves on Mac. Undo is useful immediately after a sort, but saving a separate copy is safer if the workbook is important or other people rely on it.
  • Keep a backup of the original order if you may need it. You can add an ID or sequence column before sorting, then sort by that column later to restore the original sequence. Make sure the ID is unique and included in the full range.
  • Do not try to fix every unusual order by changing the sort mode. Names with accents, apostrophes, prefixes, or different cultural ordering conventions may need a consistent, agreed rule. For a small list, confirm those cases manually rather than assuming a basic A-to-Z sort matches a directory’s preferred naming convention.

Troubleshooting

  • The header appears among the names: Undo with Ctrl+Z, reopen Data > Sort, and set My data has headers correctly. Check that the header row was included in the range. If you intended to sort data without a header, make sure the setting is unchecked.
  • Names moved but their details did not: Undo immediately. Select the entire data range and sort again, or choose Expand the selection at Excel’s prompt. If the workbook has already been saved or more changes have been made, check a backup or version history before trying to reconstruct pairings manually.
  • The list is only partly sorted: Look for blank rows or columns dividing the records, and check that the selected range includes every row. Remove or fill gaps only when appropriate, then select the complete range and sort again. If records are in an Excel table, use its header sort control or the full Sort dialog.
  • One name seems out of place: Click the cell and inspect the actual text for leading spaces, trailing spaces, spelling differences, or an unexpected apostrophe. Also confirm that the sort used the intended column and Cell Values. Correct the entry consistently, then repeat the sort.
  • The order is by first name, not last name: That is expected when each full name is stored as one text value. Split the names into separate first- and last-name fields using a method suited to the data, verify the results, and sort by the Last Name column. Do not split blindly if names have multiple parts, compound surnames, or varying formats.
  • The Sort option is unavailable or behaves unexpectedly: Check whether the worksheet is protected or whether cells are merged across records. A protected sheet may prevent sorting unless sorting is permitted in its protection settings, and merged cells can interfere with sorting. If you have permission, unprotect the sheet or address the merged layout, then try again. Avoid changing protection on a shared workbook without checking with its owner.

Frequently Asked Questions

Can I sort names alphabetically without sorting the other columns?

You can, but it is safe only when the names are a standalone list with no related details beside them. If each row contains a person’s other information, sort the whole range so the record stays intact. When Excel asks whether to expand the selection, choose that option for a multi-column list.

Does A to Z sort a full name by first name or last name?

It sorts the text in each cell from its beginning. A full name written as First Last will therefore usually be sorted by first name. To sort by surname, use a separate last-name field as the sort key.

How do I sort by last name and then first name?

Keep the names in separate columns, open Data > Sort, and add two levels. Choose Last Name for the first level and First Name for the second, with Values and A to Z for both. Include the full data range so the other details remain with each person.

Why did Excel put a name in the wrong place?

Check for extra spaces, a misspelling, or a different name format, and make sure the correct column was sorted. Names with prefixes, accents, or compound surnames may also need a consistent sorting rule. Excel orders the cell contents; it cannot infer how you want every special case handled.

Can I undo an alphabetical sort?

Use Ctrl+Z on Windows or Command+Z on Mac immediately after the sort. If you have continued editing, undo may reverse later actions too, so consider saving a copy before sorting important data. A sequence or ID column can help restore an earlier order.

Will adding new names keep the list alphabetized?

Usually, a regular range does not automatically re-sort each time you add a name. A table makes sorting controls easier to use, but you may still need to sort again after adding entries. For a frequently updated list, repeat the sort on the complete table and verify that related columns are included.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.