In Excel, when you sort text data, it always sorts it alphabetically, from A to Z or Z to A. These two orders are already available to use while sorting. And A-Z is the default order that Excel uses to sort text data.
Let’s Take an Example of Sorting in Alphabetical Order
In the below example, you have a list of names in column A.
- Select a cell from the column.

- And then, go to Data > Sort to open the SORT dialog box.

- The dialog box shows that the order is already set from A to Z.

- In the end, click OK, and it sorts all the names alphabetically from A to Z.

And if you want to use Z to A order, you need to change the order to Z to A from the “Order” drop-down. For a quick sort without the dialog box, you can also click the A to Z or Z to A button in Data > Sort & Filter.

Quick Tip: To open the SORT dialog box, use the keyboard shortcut Alt > A > S > S.
Can I Sort Numbers in an Alphabetical Order?
Excel considers numbers a different data type than text. And to sort numbers, it uses smallest to largest or largest to smallest order.
If some numbers are stored as text, Excel shows a Sort Warning and asks whether to sort anything that looks like a number as a number, or to sort numbers and numbers stored as text separately. Only the second option sorts those text numbers character by character.
If you still want to sort numbers in alphabetical order, insert a helper column, use letters in it to create the order you want, and then sort the data by that column.

In the above example, we used a helper column, as I said, and sorted the entire data based on those letters.
Using the SORT Function
In Excel, there is a new function, SORT, that you can also use (available in Microsoft 365, Excel 2021 and Excel 2024). Enter the function in a cell and select the data range you want to sort.

In the [sort_index] argument, enter 1, as we have only one column in the data. And in the [sort_order] argument, enter 1 for the ascending (A-Z) order, or -1 for the descending (Z-A) order.

=SORT(A1:A10,1,1)
The result spills into the cells below and updates when you change the names in A1:A10. To sort from Z to A, use -1 as the last argument:
=SORT(A1:A10,1,-1)
Sort a Table Alphabetically by One Column
When your data has more than one column, select a single cell in the column you want to sort by, not the whole column. Excel then picks up the full data range and keeps each row together. If you select only one column and Excel shows the Sort Warning, choose “Expand the selection”; otherwise, that column gets sorted on its own and your rows get mixed up.
With the SORT function, you can do the same by giving it the whole range and the number of the column to sort by. The following formula sorts A2:C20 by the second column, from A to Z:
=SORT(A2:C20,2,1)
Case-Sensitive Alphabetical Sort
By default, Excel ignores the case when it sorts, so “apple” and “Apple” are treated the same. If you want lowercase and uppercase to sort separately, click Options in the Sort dialog box and tick “Case sensitive”.
Frequently Asked Questions
Why is my data not sorting alphabetically?
The most common reason is leading spaces: a name that starts with a space sorts before all the others. Clean the column with the TRIM function first. Merged cells and hidden rows can also stop the sort from working.
How do I keep the header row out of the sort?
In the Sort dialog box, tick “My data has headers”. Excel then leaves the first row where it is and uses its labels in the “Sort by” drop-down.
Can I sort alphabetically by last name?
Yes, but you first need the last name in its own column. You can learn how in the sort by last name tutorial.
Written by
Puneet Gogia
Microsoft MVP — Excel · Founder, Excel Champs
Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.