<link rel="stylesheet" type="text/css" href="/mirawhite.css">

How to sort alphabetically in Excel

Updated November 26, 2026

In Excel, click one cell in the column you want to sort, then go to Data > Sort & Filter > Sort A to Z: Excel sorts the whole table by that column and keeps each row together. To sort by several columns, use Data > Sort and add levels; for a sorted copy that updates itself, use =SORT(A2:C100) in Excel 2021 or Microsoft 365. In Word, select the list and click Home > Sort.

How to sort alphabetically in Excel with the A to Z button

Excel detects the block of data around the active cell, keeps the header row at the top when it recognizes one, and moves entire rows, not just the column you clicked.

  1. Click one cell in the column you want to sort, for example in the Last name column. Do not select the whole column.
  2. Go to Data > Sort & Filter and click Sort A to Z, or Sort Z to A for reverse order.
  3. Check that the header row stayed at the top. If it was sorted with the data, press Ctrl+Z and use Data > Sort with “My data has headers” ticked.

Good to know : Blank cells always go to the bottom, whatever the direction. Spaces at the start of a cell change the order: clean the column with =TRIM(A2) first.

How to sort rows alphabetically without mixing up the data

Rows get mixed up when a single column is sorted on its own: the names move, the phone numbers next to them stay put.

  • If you selected one column and the Sort Warning appears, choose “Expand the selection”. “Continue with the current selection” sorts that column alone and breaks every row.
  • Safer still, format the data as a table (Ctrl+T): the filter arrows in the header row always sort complete rows.
  • Hidden rows are not moved by a sort, so unhide everything first.
  • Ctrl+Z undoes a sort right away. To get the original order back later, add a column numbered 1, 2, 3… before sorting, then sort on it.

How to sort by multiple columns in Excel

To sort by last name, then by first name for people who share a last name, use the Sort dialog. Excel accepts up to 64 sort levels.

  1. Click a cell inside the table and go to Data > Sort & Filter > Sort.
  2. Tick “My data has headers” so the first row stays in place.
  3. In Sort by, pick the first column (Last name), keep Cell Values under Sort On and A to Z under Order.
  4. Click Add Level, pick the second column (First name) and A to Z, then click OK.

Good to know : Excel ignores case by default. The Options button in the same dialog offers Case sensitive, which puts lowercase before uppercase (a A b B), and Sort left to right, which reorders columns instead of rows.

Sort with a formula: SORT and SORTBY

In Excel 2021, Excel 2024, Microsoft 365 and Excel for the web, SORT returns a sorted copy of a range that updates when the source changes; Excel 2019 and older do not have it. The result spills into the empty cells below and to the right.

  • =SORT(A2:C100) sorts the rows by the first column of the range, A to Z.
  • =SORT(A2:C100,2,1) sorts by the second column; use -1 instead of 1 for Z to A.
  • =SORTBY(A2:C100,B2:B100,1,A2:A100,1) sorts by column B, then by column A, like a two-level sort.
  • To freeze the result, copy it and use Paste Special > Values.
=SORT(A2:C100,2,1)

How to sort alphabetically in Word: lists and tables

Word sorts paragraphs, so each item must be on its own line: a bulleted or numbered list, a list of names, a bibliography.

  1. Select the list.
  2. On the Home tab, click Sort (the A-Z button in the Paragraph group).
  3. Set Sort by to Paragraphs and Type to Text, choose Ascending, then click OK.
  4. For a table, click inside it, open the Layout tab next to Table Design and click Sort. Say whether the table has a header row and pick up to three columns.

Good to know : Word for the web cannot sort lists: open the document in the desktop app. In the Sort dialog, Options lets you make the sort case sensitive, choose the sorting language or split lines into fields at tabs or commas.

Google Sheets, Google Docs and LibreOffice

In Google Sheets, right-click a column letter and choose Sort sheet A to Z: every row moves with it. For part of the sheet or several columns, select the cells, go to Data > Sort range > Advanced range sorting options, tick “Data has header row”, choose a column, click “Add another sort column” if needed, then Sort. Sheets also has =SORT(A2:C100,1,TRUE), where TRUE means A to Z.

Google Docs has no sort command: paste the list into a Sheets column, sort it and paste it back, or use the online tool below.

In LibreOffice Calc, Data > Sort has an Options tab with natural sort (A2 before A10) and a locale setting. In Writer, Table > Sort sorts selected paragraphs as well as table rows.

Capitals, accents and numbers: why the order looks wrong

Microsoft notes that sort orders vary with the locale set in Windows. Most surprises come from one of these cases:

  • A basic computer sort (character code, ASCII) puts capitals before lowercase and accented letters after z: Anaïs, Zoé, eclair, zèbre, Émile, école. Dictionary order gives Anaïs, eclair, école, Émile, zèbre, Zoé.
  • Excel compares text character by character, so “Room 10” sorts before “Room 2”. Type 02, 03… or move the number to its own column.
  • Numbers stored as text sort after real numbers: give the whole column one format, Number or Text.
  • Other languages have other rules: in Spanish, ñ is a separate letter after n; German dictionaries sort ä like a (DIN 5007-1), phone books like ae (DIN 5007-2).

Sort a list alphabetically online with Utiloz

When the list is not in a spreadsheet, such as names copied from an email, a web page or a Google Doc, paste it into Sort lines alphabetically on Utiloz, one item per line, and choose A to Z or Z to A. It uses dictionary order, and “Natural number order”, on by default, puts “item 2” before “item 10”, which Excel does not. Other modes sort by character code (ASCII), by the first number in each line or by line length; copy the result or download a .txt file.

Rows copied from Excel or Google Sheets arrive with tab-separated cells, so each row moves as a whole, sorted by its first column. It all runs in your browser: nothing is uploaded, no sign-up. Tick “Remove duplicate lines” to keep one copy of each line, or use Remove duplicate lines to also ignore case and accents.

Frequently asked questions

How do I sort rows alphabetically in Excel without mixing data?

Click a single cell in the column to sort by, not the whole column, then use Data > Sort A to Z: Excel moves complete rows. If a Sort Warning appears, choose “Expand the selection”.

How do I sort alphabetically in Excel by last name?

If the last name has its own column, sort on it. If the full name is in one cell, split it first with text functions or the Convert Text to Columns Wizard (space as delimiter), then sort by last name and add first name as a second level.

How do I sort lines alphabetically in Google Docs?

Google Docs has no built-in sort. Paste the lines into a Google Sheets column, right-click the column letter, choose Sort sheet A to Z and paste them back, or sort them with an online tool.

Why does Excel put “item 10” before “item 2”?

Excel sorts text character by character, and 1 comes before 2. Write numbers with the same number of digits (item 02), put them in a separate numeric column, or use a tool with natural number order.

Can Excel sort alphabetically automatically?

Yes, with =SORT(A2:C100) in Excel 2021, 2024 or Microsoft 365: the copy updates when the source changes. A sort made with the A to Z button is a one-off; Ctrl+Alt+L reapplies it after you edit the data.

← All guides