To sort a column A to Z in Excel while keeping each row intact, select the entire data range first (including all columns that belong to each record), then use Data > Sort and choose the column to sort by. The key is to let Excel sort the whole range, not just the single column, so that every cell in a row moves together. If you select only one column and click Sort A to Z, Excel may ask whether to expand the selection; choose Expand the selection to preserve row integrity.

What You'll Need

  • Microsoft Excel (desktop version for Windows or Mac; the web version works similarly but some dialogs differ).
  • A worksheet with data arranged in columns, ideally with a single header row at the top.
  • No blank rows or columns inside the data range you intend to sort—Excel uses these as boundaries and may leave parts of the data unsorted.

Step-by-Step

  1. Make a backup copy of your sheet. Sorting is easy to undo with Ctrl+Z (Cmd+Z on Mac) immediately after, but a copy protects you if you sort, save, and close. Right-click the sheet tab and choose Move or Copy > Create a copy.
  2. Click any single cell inside your data range. Do not select the whole column by clicking the column letter—that selects entire columns and can cause Excel to sort only that column. A single cell inside the block is enough; Excel will detect the surrounding range.
  3. Go to the Data tab on the ribbon. In the Sort & Filter group, click Sort (not the A→Z button yet). The Sort dialog opens. Menu labels can differ slightly by Excel version, device, and region.
  4. Check the “My data has headers” box if your first row contains column titles. This tells Excel not to sort the header row into the data. If you leave it unchecked, your headers will be treated as data and sorted alphabetically, which usually ruins the sheet.
  5. In the Sort by dropdown, choose the column you want to sort alphabetically. For example, choose “Last Name” or “Product.” Leave Sort On as “Cell Values” and Order as “A to Z.”
  6. Click OK. Excel sorts the entire contiguous range by that column, moving each row as a unit. All other columns stay aligned with their original row.
  7. Verify the result. Scan a few rows to confirm that values in other columns still belong to the same record. If something looks scrambled, press Ctrl+Z (Cmd+Z) immediately to undo and try again with the full range selected.

If you prefer the quick button: select the entire data range (click the top-left cell, then Shift+click the bottom-right cell), then click Data > Sort A to Z. Excel sorts the whole selection. This works well when you have already selected all columns. The Sort dialog is safer because it forces you to confirm headers and the sort column.

Common Mistakes

  • Selecting only one column before sorting. This is the most common cause of misaligned rows. Excel may sort only that column and leave the rest untouched, or it may show the “Sort Warning” dialog. Always select the full range or click a single cell inside it and use the Sort dialog.
  • Ignoring the “My data has headers” checkbox. If headers are sorted as data, the header row moves into the middle of the list. Undo and re-sort with the box checked.
  • Leaving blank rows or columns inside the data. Excel treats a blank row as the end of the range, so data below it may not be sorted. Remove blank rows or select the full range manually.
  • Sorting a filtered list without checking hidden rows. Excel sorts visible rows by default in some versions, which can mix hidden rows. Clear filters first if you need a full sort.
  • Forgetting that merged cells block sorting. Unmerge cells before sorting; Excel cannot sort a range with merged cells without errors.

Tips

  • Use Ctrl+Shift+L (Cmd+Shift+L on Mac) to toggle filter arrows on your header row. Filtering is often safer than sorting when you only need to view a subset.
  • For a permanent A-to-Z order that updates when data changes, consider sorting once and then using a table (Insert > Table). Tables keep rows together when you sort or filter.
  • If you need to sort by multiple columns (e.g., last name, then first name), use Data > Sort and click Add Level in the dialog.
  • To sort case-sensitively, click Options in the Sort dialog and check “Case sensitive.” This is rarely needed but useful for codes.
  • Keep a helper column with a unique ID if you plan to sort repeatedly; you can always restore the original order by sorting on that ID.

Troubleshooting

Rows are misaligned after sorting. Undo immediately with Ctrl+Z. Then select the entire data range (including all columns) and use Data > Sort, making sure “My data has headers” is set correctly. If the problem persists, check for blank columns inside the range—Excel may treat them as the edge of the data.

Excel says “This operation requires the merged cells to be identically sized.” You have merged cells in the range. Select the range, go to Home > Merge & Center, and choose Unmerge Cells. Then sort again.

The Sort A to Z button is grayed out. This can happen if the sheet is protected or if you are in a cell that is part of an array formula. Check Review > Unprotect Sheet (you may need a password), and avoid sorting ranges that contain array formulas.

Only part of the data sorted. Likely a blank row or column split the range. Select the full intended range manually before sorting, or delete the blank rows/columns. Also confirm that the range does not contain hidden rows that were excluded.

The header row moved into the data. Undo, then re-open the Sort dialog and tick “My data has headers.” If your header row is not a single row, consider inserting a proper header row before sorting.

Sorting seems to ignore numbers or dates. Excel may be treating them as text. Check the cell format (Home > Number Format). Text-formatted numbers sort alphabetically (1, 10, 2) rather than numerically. Convert them to numbers or dates before sorting.

Frequently Asked Questions

How do I sort A to Z without messing up the rest of the row?

Select the whole data range (or click one cell inside it), then use Data > Sort and pick your column. Excel moves entire rows as long as the range includes all columns. Avoid clicking the column letter and then Sort A to Z, which can sort only that column.

What does “Expand the selection” mean in the Sort Warning?

When you sort a single column, Excel may ask whether to expand the selection to nearby data. Choose “Expand the selection” to keep rows intact. Choose “Continue with the current selection” only if you truly want to sort that column alone, which will break row alignment.

Can I sort by last name when the full name is in one column?

Not directly with a simple A to Z sort, because Excel sorts the entire cell text. You can use Text to Columns (Data > Text to Columns) to split first and last names into separate columns, then sort by the last-name column. Alternatively, use a formula to extract the last name into a helper column and sort on that.

Does sorting keep formulas and formatting with the row?

Yes, when you sort a full range, Excel moves cell contents, formulas, and most formatting with the row. Relative references inside formulas adjust as usual; absolute references stay fixed. Always test on a copy if formulas are complex.

Why did my sort put “10” before “2”?

Those values are stored as text, so Excel sorts them character by character. Convert the column to numbers (select the column, then use Data > Text to Columns > Finish, or change the cell format to Number) and sort again.

Can I undo a sort after saving and closing the file?

No. Undo history is cleared when you close the file. That is why making a backup copy before sorting is recommended. If you have saved and closed, you would need to restore from a previous version or backup.