The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →To sort spreadsheet rows by a column in Excel, click a cell in that column and choose Data > Sort A to Z or Data > Sort Z to A. Excel should move each complete record together. For multiple sort keys or a custom order, use Data > Sort instead.
Choose the right sorting method
| What you need | Use this method |
|---|---|
| One key, ascending or descending | Quick A to Z or Z to A sort |
| Several keys, a custom order, or formatting-based sort | Sort dialog |
| Records arranged horizontally | Sort left to right in the Sort dialog |
| A separate sorted result that updates from a formula | SORT or SORTBY, in supported Excel versions |
1. Sort by one column with A to Z or Z to A
- Click a cell in the column you want to sort by.
- Open the Data tab and select Sort A to Z for ascending order or Sort Z to A for descending order.
- If Excel asks whether to expand the selection, choose to expand it when the neighboring columns belong to the same records.
This quick method is suitable for a simple sort, such as putting names in alphabetical order or values from smallest to largest. The goal is to reorder entire records, not just the selected column.
2. Sort by multiple columns or set explicit options
- Click a cell in the dataset and choose Data > Sort.
- Set whether the data has a header row. Check that Excel treats headings as labels rather than values to sort.
- Choose the first column under Sort by, then select the sort-on criterion and order.
- Select Add Level to specify another column. Add further levels as needed, then apply the sort.
Excel applies the higher-level criterion first, then uses each lower-level criterion to order records that match the preceding one. For example, sort by Department and then Employee to group employees by department and alphabetize names within each group. Microsoft documents support for up to 64 sort columns in the desktop Sort dialog (Microsoft Support).
The dialog also lets you sort by cell color, font color, or icon, and specify a custom sequence. For colors and icons, define the order you want: Excel has no default sort order for them.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minute#1 Best Overall
- The Microsoft Office 365 Bible: The Most Updated and Complete Guide to Excel, Word, PowerPoint, Outlook, OneNote, OneDrive, Teams, Access, and Publisher from Beginners to Advanced
- ABIS BOOK
3. Sort from left to right
Use this when your records run across columns rather than down rows. In Data > Sort, select Options, choose Sort left to right, then select the row that contains the values to sort by and set the order.
Excel tables do not support left-to-right sorting. Convert the table to a range before using this orientation. Microsoft’s sort guidance describes this option and its table limitation (Microsoft Support).
4. Create a sorted result with SORT or SORTBY
A formula can return a sorted array separately from the source data, leaving the original order in place. Microsoft lists SORT for Microsoft 365, Excel 2024, and Excel 2021 on the platforms covered by its support page; formula availability may differ in older editions.
Use SORT
The syntax is =SORT(array,[sort_index],[sort_order],[by_col]). The array is the range to return; sort_index chooses the column or row within it, and sort_order is 1 for ascending or -1 for descending. The optional by_col argument specifies column-based sorting.
Rank #3
Use SORTBY
SORTBY sorts an array according to values in a corresponding range or array. It can be useful when you want to return one range ordered by a separate key range. See Microsoft’s documentation for SORT and SORTBY for the function details and supported versions.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Prevent mistakes and fix unexpected results
- Sort the whole dataset. Sorting only one column within a larger set can separate values from their records. When prompted, expand the selection so associated columns move together. Microsoft warns against sorting only part of a range (Microsoft Support).
- Check the header setting. If a heading appears among the sorted values or is missing from the results, verify whether Excel is treating the first row as headers.
- Unhide rows and columns first. Hidden rows or columns are not moved with a sort, so unhide them if the result seems incomplete (Microsoft Support).
- Check numbers stored as text. Values that look numeric but are stored as text may sort unexpectedly. Also check for inconsistent headers, blank cells, locale settings, or formulas that have not recalculated.
- Split out the part you want to sort by. If you need to sort full names by surname, first put the surname in its own column, then sort on that column.
The main Microsoft sorting instructions cover Excel for Microsoft 365, Excel 2024, 2021, 2019, and 2016. Labels and locations can vary somewhat across desktop, Mac, web, and mobile versions.
Quick Recap
Best Value
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

