To sort data from A to Z in Excel for Microsoft 365 on Windows, click a cell in the column you want to sort, then choose Data > Sort A to Z. Excel arranges text alphabetically, numbers from smallest to largest, or dates from oldest to newest; if your data has several columns, make sure the entire table moves together.
What A to Z means in Excel
A to Z is Excel’s ascending sort order. It is not a text-formatting style: it rearranges the order of cells or rows according to their values. For text, the order generally follows the alphabet, so entries such as Alvarez, Chen, and Patel appear in that sequence. For numbers, ascending order means low to high, and for dates it means earliest to latest.
The label is still A to Z when the selected column contains numbers or dates. Excel works out the sort order from the data type rather than changing the command’s name. The reverse command is Sort Z to A, which places text in reverse alphabetical order, numbers from largest to smallest, and dates from latest to earliest.
Sorting changes the displayed order of records, not the underlying values. It can be undone immediately with Ctrl+Z on Windows, but it is sensible to keep a backup before applying complex sorts or sorting important data.
Sort a list or table in one step
For a simple, continuous list, use these steps in Excel for Microsoft 365 on Windows:
- Click a cell in the column whose values should determine the order. You usually do not need to select the whole column.
- Open the Data tab on the ribbon.
- In the Sort & Filter group, choose Sort A to Z.
- Check that the records are still aligned across all columns. If they are not, undo immediately with Ctrl+Z and sort the full data range instead.
You can also use Home > Sort & Filter > Sort A to Z. In Excel for Mac, the corresponding ascending-sort command is available from the Data tab; ribbon layout can vary slightly by release. In Excel for the web, use the Data tab’s sort command as well. If Excel detects a header, it normally leaves that header at the top rather than treating it as a record.
Keep complete rows together
A record often spans several columns. For example, a contact list might have Name, City, and Email columns. Sorting only the names while leaving the other columns in place would attach the wrong city and email to each person. Excel commonly recognizes a continuous block of adjacent data and expands the sort to include it, but do not assume it has done so without checking.
If Excel displays a Sort Warning after you start a sort, choose Expand the selection to move the related cells together. Choosing Continue with the current selection sorts only the selected cells, which can scramble the relationships between columns. For a data range with gaps or unrelated information immediately beside it, select the complete range first, including every column that belongs to each record.
For a reusable list, turning the range into an Excel table can make sorting and filtering more predictable. Select a cell in the range and choose Insert > Table, then confirm whether the table has headers. Table header drop-downs provide sorting options for each column, and adding rows to the table keeps them within the table structure.
Choose a sort column and check the header
A one-click A to Z sort uses the column containing the active cell as its sort key. If you click a cell in the City column, Excel sorts by city; if you click a cell in Last Name, it sorts by last name. That is convenient for quick sorting, but a deliberate selection helps when a worksheet contains multiple blocks or blank columns.
To set the sort key explicitly, click in the data and choose Data > Sort. In the Sort dialog, choose the column under Sort by, select Cell Values under Sort On, and choose A to Z under Order. If Excel has identified a header row, the My data has headers option keeps the headings out of the sorted records. Check this setting if the first row looks like it has been moved into the body of the list, or if a data row has been mistaken for a heading.
A good header is a single, clearly labeled row directly above the records. Merged cells, blank header names, blank rows within a list, and totals mixed into the records can make the data harder for Excel to interpret. Clean up those structures before sorting when possible.
Sort by more than one column
A to Z on one column does not define the order of records that have matching values in that column. To sort by a primary field and then use another field to order ties, use the Sort dialog. For example, a class list could be sorted by City first and Last Name second.
- Click a cell in the data and choose Data > Sort.
- Set the first level under Sort by, such as City, and choose A to Z.
- Choose Add Level.
- Set Then by to Last Name and choose A to Z again.
- Confirm that the header setting is correct, then select OK.
Excel applies the first level as the main sort and the next level within groups that have equal values in the earlier field. You can add more levels when needed, such as sorting by department, then surname, then first name. The order of the levels matters: reversing the first and second fields changes the main grouping.
What happens with blanks, numbers, and mixed text
Blank cells commonly appear after populated cells in an ascending sort, though the result can depend on the sort and data structure. If blank records are meaningful, check where they end up rather than assuming they will remain in their original positions. Remove fully empty rows from the middle of a list when they are accidental; they can interrupt Excel’s recognition of a continuous range.
Numbers that look alike may sort differently if some are stored as text. For example, text values such as 1, 10, and 2 can sort alphabetically as 1, 10, 2, instead of numerically as 1, 2, 10. A small warning indicator, inconsistent alignment, or a mixed result can be a clue. Convert the affected values to numbers before sorting if they are meant to be numeric; changing the cell’s number format alone does not necessarily convert text into numbers.
Dates can have a similar issue: a date-looking entry stored as text may not sort chronologically with real date values. Check that the cells contain genuine Excel dates and use a consistent format. For names with prefixes, punctuation, or accented characters, the visible order may not match a person’s idea of how names should be grouped. If the standard ascending order is unsuitable, use a custom list or add a helper column that defines the intended order.
Sort by color or use a custom order
Alphabetical order is not always the order a worksheet needs. The Sort dialog can sort by cell color, font color, or an icon when those are present, and it can use custom lists for sequences that are not alphabetical. For example, a custom order could place High, Medium, and Low in that order rather than alphabetizing them as High, Low, Medium.
Choose Data > Sort, select the relevant column, and change Sort On from Cell Values to the applicable color, font color, or icon option when available. The Order controls then let you specify the desired placement. For a built-in or custom list, select the custom-list order in the Order controls if it is offered for the field. These options are useful for priority labels, workflow stages, and color-coded status cells, but they do not replace cleaning inconsistent values. For instance, Priority and priority may represent the same category to a person but still be different text entries.
Common sorting problems and fixes
- Only one column moved: Undo, select the complete range, and sort again. When prompted, choose Expand the selection.
- The heading was sorted with the records: Open Data > Sort and check My data has headers. Make sure the header row is clear and included in the selected range.
- The order looks strange: Check for numbers or dates stored as text, extra spaces, inconsistent spellings, and blank rows. Correct the underlying values before sorting again.
- Some records did not move: Look for gaps, separate blocks, or rows outside the selected range. Select all records and their related columns before sorting.
- A formula result seems out of order: Confirm that the cells contain comparable values. Text returned by a formula sorts as text, even when the displayed characters look numeric.
Sorting rearranges rows, so references in formulas and other workbook features may respond to the new arrangement. If a sheet contains subtotals, merged cells, or carefully arranged sections, make a copy first and check the result before continuing. Sorting one section of a worksheet does not automatically make unrelated sections part of the same dataset.
Frequently Asked Questions
How do I sort alphabetically in Excel without mixing up rows?
Click a cell in the column to sort and choose Data > Sort A to Z. If Excel prompts you, choose Expand the selection. For extra certainty, select the full data range first and confirm that the header option is set correctly in the Sort dialog.
Does A to Z sort numbers from low to high?
Yes. Excel’s ascending A to Z command sorts numeric values from smallest to largest and dates from earliest to latest. If numbers are stored as text, they may instead follow text order, so convert them to numeric values when numeric sorting is intended.
How do I keep the header row at the top?
Use a clearly labeled first row and, in Data > Sort, make sure My data has headers is selected. Excel usually detects straightforward headers, but checking the setting is useful when the first row contains unusual formatting or blank labels.
Can I sort by last name when a cell contains a full name?
A standard A to Z sort compares the full cell value; it does not automatically identify the last name inside a full-name entry. Separate first and last names into different columns, or create a helper column that extracts the surname, then sort by that column.
Can I return to the original order after sorting?
Use Ctrl+Z on Windows or Command+Z on Mac immediately after the sort to undo it. For a reliable way to restore an original order later, add an index column containing 1, 2, 3, and so on before sorting. Sorting that index column ascending restores the recorded sequence.
Related
- Excel File With Table Filters: How to Add and Use Them
- Excel File Too Large? How to Make It Smaller in Excel
- Excel File Too Large to Email? Practical Fixes
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- INDEX MATCH With Two MATCH Functions: Practical ExamplesYes: the standard two-way lookup uses INDEX with one MATCH to find a row and a second MATCH…
- Excel Spreadsheet Sort by Highest Number: Steps & TipsTo sort an Excel spreadsheet by its highest number, click a cell in the number column and choose…
- Calculate Percentage in Excel: Formulas for a ColumnTo calculate a percentage in an Excel column, divide each part by its whole, then format the results…
- XLOOKUP Case Sensitivity: How Excel Matches Text ValuesNo. In Excel for Microsoft 365, XLOOKUP is not case-sensitive: it treats text such as “Maple,” “MAPLE,” and…
- VLOOKUP Across Sheets in Excel: Formulas and FixesTo use VLOOKUP across sheets in Excel, enter a formula such as =VLOOKUP(A2,Products!$A$2:$D$100,3,FALSE) on the sheet where you…
- Excel Timesheet: Calculate Hours Worked With FormulasTo calculate a shift in an Excel timesheet, put the start time in C2, end time in D2,…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.