Sort Alphabetically in Excel: Step-by-Step Guide

Learn how to sort text data A–Z and Z–A.

Most people think sorting alphabetically in Excel is just clicking a button. And it is, until it isn't. The button works fine on clean data. The moment you have trailing spaces, numbers formatted as text, or a merged cell hiding somewhere in your table, that same click produces results that look right but aren't. I've watched colleagues stare at a sorted column for ten minutes trying to figure out why "Smith, John" appeared between two entries that both started with T.

This guide covers how to sort alphabetically in Excel the right way: A–Z and Z–A, single and multiple columns, last-name sorting, and the SORT formula for Microsoft 365 users who want results that update automatically. I'll also cover the three failure modes that make sorting go quietly wrong, because that's the part most tutorials skip.


What You'll Be Able to Sort (and One Thing to Check Before You Alphabetize in Excel)

Everything in this guide applies to sorting a column or range alphabetically while keeping the rest of your rows intact. That second part, keeping rows intact, is where most sorting disasters actually happen. If you select one column and sort it in isolation, the names in column A will move but the sales numbers in column B won't. You've just scrambled your data.

Before you sort anything, scan your data for blank rows. A blank row tells Excel your data ends there. It'll sort everything above the blank row and ignore everything below it. One missing row can split your dataset in half without a single warning.

One version note: Steps 1 and 2 work in every modern version of Excel. Step 3, the SORT formula, requires a Microsoft 365 subscription. If you're on Excel 2019 or earlier, skip that section.


Step 1: Sort Alphabetically in Excel Using the Data Tab (Quickest Method)

Once your data has no blank rows, you're ready to sort. The Data tab is where most of the sorting tools live, and it's the method that works across all versions.

How to Sort a Single Column A–Z or Z–A Without Scrambling Your Rows

  1. Click any cell inside the column you want to alphabetize. Don't select the entire column, or you'll sort it independently from the rest of your table.
  2. Go to the Data tab in the ribbon.
  3. Click A→Z for ascending order (A at the top) or Z→A for descending order (Z at the top).

Excel should detect your full table automatically and move entire rows together. If it asks whether to "expand the selection," always choose expand. Sorting just one column without expanding is almost never what you want. Expanding tells Excel to treat your table as a unit and keep each row's data connected.

How to Sort Multiple Columns Alphabetically Using the Excel Sort Dialog Box

Sorting by one column is fine for a simple list. For anything more complex, say, sorting by region first and then by last name within each region, you need the Excel Sort dialog box.

  1. Click anywhere in your data range.
  2. On the Data tab, click Sort (not the A–Z button — the Sort button opens the full dialog).
  3. In the dialog, set your first sort column and choose A to Z.
  4. Click Add Level to add a second sort criterion, then set that column.
  5. Click OK.

This is the custom sort approach, and it's where the real control lives. I use it any time I'm working with regional sales data: sorting by territory first, then by rep name, keeps the output readable in a way that a single-column sort never does. If you're on a Mac, the same dialog is available and the steps are identical, though the interface looks slightly different. The guide to sorting and filtering in Excel on Mac covers those differences.


Step 2: Sort by Last Name in Excel When Names Are Stored First-Name First

With the basic sort working, here's a problem that comes up constantly in employee and contact lists: names are stored as "Sarah Chen" or "Marcus Rivera," but you need to sort alphabetically by last name. A straight A–Z sort will alphabetize by first name instead.

The fix is a helper column. In an empty column next to your names, use this formula to extract the last name:

=TRIM(MID(A2,FIND(" ",A2)+1,100))

That formula finds the space character and grabs everything after it. The TRIM is there because leading or trailing spaces, the invisible kind that show up in imported data, will throw off the result. I add TRIM by reflex at this point. Once the trailing-space problem has burned you enough times, it becomes automatic.

Once the helper column is populated, sort on that column A–Z using the steps from Step 1. After sorting, you can delete the helper column if you don't need it. Flash Fill (Ctrl+E) is a faster option if your names follow a consistent pattern — Excel will often figure out what you're extracting after one or two examples.


Step 3: Auto Sort Alphabetically in Excel with the SORT Formula (Microsoft 365 Only)

The methods above produce a static result. You sort once and the order is fixed. If new rows get added, you sort again.

In Microsoft 365, there's a better option for lists that change frequently. The SORT function outputs a sorted version of your data as a dynamic array — it updates automatically when the source data changes. No re-clicking required.

The basic syntax:

=SORT(A2:B10, 1, 1)

In plain terms: sort the range A2:B10, by the first column, in ascending order (1 = ascending, -1 = descending). The result spills into adjacent cells automatically. This is the SORT function's dynamic array behavior — one of the genuinely useful additions Microsoft 365 introduced. As of 2026 it's still not available in Excel 2019 or earlier. If the SORT function isn't available in your version, Steps 1 and 2 are all you need.

Make sure the cells where the SORT result will spill are empty. If any cell in the spill range is occupied, Excel will return a #SPILL! error.


Common Mistakes When You Sort Data Alphabetically in Excel (and How to Fix Them Fast)

Three problems account for the vast majority of broken sorts.

Blank Rows Splitting Your Sort Range

If your sorted list seems to stop partway through the data, look for a blank row. Delete it or fill it in before sorting. I scan for blank rows before doing anything else with imported data — it's a habit that has saved a lot of backtracking.

Numbers Stored as Text Sorting in the Wrong Order

If you imported data from another system, a column that looks like numbers might actually be text. The tell is a small green triangle in the upper-left corner of the cell. Text-formatted numbers sort character by character, so 10 comes before 2.

To fix text-formatted numbers: select the column, click the warning icon that appears, and choose Convert to Number. After that, the sort works correctly.

Merged Cells Blocking the Sort Entirely

Merged cells will stop a sort cold. Every time. Excel can't sort a range that contains merged cells because it can't move partial merges. If you hit this error, unmerge the cells first (Home tab, then click Merge & Center to toggle it off), sort, then reformat if you need the visual effect back.

Merged cells break more things than they fix. A sorting article feels like the right place to say that plainly.

For a deeper look at why sorting goes wrong and how to recover, the guide to common sorting errors and fixes is worth bookmarking.

If the Data tab or Sort dialog felt unfamiliar, the Excel for Beginners starter guide covers the foundational navigation that makes all of this click faster.

If you take one thing from this article: always select a cell inside your full table before you sort — never just the column you want to alphabetize. That single habit prevents the row-scrambling problem that makes people think Excel sort is broken when it isn't.


Frequently Asked Questions

How do I alphabetize in Excel without mixing up rows?

Click a single cell inside your data table — not the entire column — before you sort. When you use the A–Z button on the Data tab from inside the table, Excel automatically moves entire rows together, keeping each record intact. If Excel asks whether to expand the selection, always choose expand.

Why is my Excel sort not working correctly?

The three most common causes are blank rows splitting the sort range, numbers stored as text (look for the green triangle in the cell corner), and merged cells in the range. Remove blank rows, convert text-formatted numbers using the cell warning icon, and unmerge any merged cells before sorting.

How do I sort by last name in Excel when names are in First Last format?

Add a helper column using =TRIM(MID(A2,FIND(" ",A2)+1,100)) to extract the last name from each cell. Sort on that helper column A–Z, then delete it once the sort is done. Flash Fill (Ctrl+E) is a faster alternative if your name format is consistent throughout the column.