Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Column Sorting: Step-by-Step How-To

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Excel column sorting rearranges rows based on the values in one column, keeping related data in each row intact. To do it, select any cell in the column, open the Data tab, and click Sort A to Z or Sort Z to A. Excel automatically expands the selection to the whole data range, so other columns stay aligned with their rows.

What You'll Need

  • Excel 2016 or later (Windows or Mac) or Excel for the web. Steps below use the desktop ribbon; menu labels may differ slightly by version, device, or region.
  • A worksheet with data arranged in columns, ideally with a single header row.
  • No merged cells in the range you plan to sort — merged cells block sorting.

Step-by-Step

  1. Prepare your data. Make sure each column has a clear header in row 1 and that there are no completely blank rows or columns inside the data. Blank rows can cause Excel to treat the range as multiple separate tables.
  2. Select a single cell in the column you want to sort. Do not select the entire column by clicking the column letter — that includes the header and any unrelated data far below, and Excel may warn that it found data outside your selection.
  3. Go to the Data tab on the ribbon. In the Sort & Filter group you will see Sort A to Z, Sort Z to A, and a larger Sort button. The A-to-Z and Z-to-A buttons sort the whole contiguous data range based on the column of the active cell.
  4. Click Sort A to Z for ascending order (numbers low to high, text A to Z, dates oldest to newest) or Sort Z to A for descending order. Excel will expand the selection automatically if it detects adjacent data. If a dialog appears asking to expand the selection, choose Expand the selection and click Sort.
  5. Verify the header row stayed in place. If your header ended up sorted into the data, undo with Ctrl+Z (Cmd+Z on Mac), then use the full Sort dialog instead: Data > Sort, tick My data has headers, and choose the column under Sort by.
  6. For multi-level sorting, open Data > Sort. In the dialog, set Sort by to your primary column, then click Add Level to sort by a second column (for example, sort by Department, then by Last Name). Choose the order for each level and click OK.
  7. To sort only part of a column, select just those cells first. Excel will ask whether to expand the selection or continue with the current selection. Choose Continue with the current selection only if you are certain the other columns do not need to stay aligned — otherwise choose Expand.
  8. Save your work. Sorting changes the order of rows permanently in the file, so press Ctrl+S (Cmd+S on Mac) once you are satisfied.

Common Mistakes

  • Sorting a single column without expanding the selection. This scrambles row relationships — names no longer match phone numbers, for example. Always let Excel expand to the full range unless you deliberately want to reorder one column in isolation.
  • Leaving blank rows or columns in the data. Excel treats the blank as the end of the range, so only part of your data gets sorted. Delete or fill blanks first.
  • Merged cells. Sorting fails or produces an error when the range contains merged cells. Unmerge them (Home > Merge & Center) before sorting.
  • Forgetting the header row. If Excel treats your headers as data, they get sorted into the list. Use Data > Sort and tick My data has headers to prevent this.
  • Sorting formatted cells with mixed data types. Numbers stored as text sort differently from real numbers. Check with a quick glance — left-aligned numbers in a column are usually text.

Tips

  • Use the full Sort dialog (Data > Sort) for anything beyond a simple A-to-Z sort — it gives you control over headers, multiple levels, and custom orders.
  • Before sorting a large or important sheet, make a copy of the worksheet (right-click the tab > Move or Copy > Create a copy) so you can compare or revert.
  • To sort by month names or weekdays correctly, use Data > Sort > Order > Custom List and pick the built-in list rather than alphabetical order.
  • If you want the sort to update automatically when data changes, convert the range to a table (Insert > Table) and use the filter arrows in the header row — though note that table sorts still reorder rows permanently.
  • Freeze the header row (View > Freeze Panes > Freeze Top Row) so you can see column labels while checking the sorted result.

Troubleshooting

Excel says "This operation requires the merged cells to be identically sized." Unmerge the cells in the range, sort, then re-merge if needed.

Only some rows moved. A blank row or column split your range. Remove the blank, reselect a cell inside the data, and sort again.

The header row sorted into the data. Undo, then use Data > Sort with My data has headers ticked.

Numbers sort as text (1, 10, 2 instead of 1, 2, 10). Convert the column to numbers: select the cells, then use Data > Text to Columns > Finish, or multiply by 1 in a helper cell and paste values back. Sorting will then follow numeric order.

Sort options are greyed out. You may be in a protected sheet or editing a cell. Press Esc, unprotect the sheet (Review > Unprotect Sheet) if you have the password, and try again.

Frequently Asked Questions

Does sorting in Excel keep rows together?

Yes, when Excel expands the selection to the whole data range. If you choose "Continue with the current selection" instead, only the selected cells move and rows can become misaligned.

Can I sort by more than one column?

Yes. Open Data > Sort, set the first column under Sort by, then click Add Level to add a second or third column with its own order.

How do I sort a column without affecting the rest of the sheet?

Select only the cells you want to reorder, then in the warning dialog choose Continue with the current selection. Be aware this breaks the link between those cells and the rest of their rows.

Why did my header row get sorted?

Excel did not recognise it as a header. Undo, then use Data > Sort and tick My data has headers so row 1 stays fixed.

Can I undo a sort?

Yes, immediately after sorting press Ctrl+Z (Cmd+Z on Mac). Once you save and close the file, the previous order is not recoverable unless you kept a copy.

Does sorting work the same in Excel for the web?

The basic A-to-Z and Z-to-A buttons and the Sort dialog are available, but some custom list options may differ. Labels can vary slightly by version and region.