To reorder data in Excel, select the entire table (or click any cell inside it), open the Data tab, and use Sort to rearrange rows by one or more columns, or Filter to hide rows you do not want. For a manual drag, hold Shift while dragging a row or column border. The key rule is to let Excel move whole rows together: if you sort a single column on its own, the values in that column split away from the rest of their row and the data is corrupted. The steps below cover sorting, custom lists, manual dragging and the mistakes that break tables.
What You'll Need
- Excel for Windows, Mac, or Excel for the web (menus are nearly identical; button positions can differ slightly by version and region).
- A table where each column holds one type of data (names, dates, amounts) and each row is one record.
- Optional: a header row. Excel detects headers automatically, but you can confirm it in the Sort dialog.
Step-by-Step
- Make a backup first. Press Ctrl+C (Windows) or Cmd+C (Mac) on the sheet tab and paste a copy, or save a duplicate file. Sorting is easy to undo with Ctrl+Z, but a copy protects you once you have saved and closed the file.
- Select the whole table, not one column. Click any single cell inside the data and Excel will treat the surrounding block as one table. If you prefer to select manually, drag from the top-left cell to the bottom-right cell. Never click a column header letter and sort, because that sorts only that column.
- Check for blank rows and columns. A completely empty row or column splits your data into separate blocks, and Excel will sort only the block your cursor is in. Delete or fill the gaps first.
- Open the Sort dialog. Go to Data > Sort. The small A–Z and Z–A buttons on the ribbon work for a quick single-column sort, but the dialog gives you control over headers, multiple levels and custom order.
- Confirm the header setting. In the Sort dialog, tick My data has headers if your first row contains column names. If you leave it unticked, Excel will sort your header into the data as if it were a value.
- Choose the column and order. Under Sort by, pick the column you want to reorder by. Under Order, choose A to Z, Z to A, or Custom List (see the tips below). For dates, A to Z means oldest first; for numbers, smallest first.
- Add a second level if needed. Click Add Level and repeat. For example, sort by Department first, then by Last Name, so each department is alphabetical internally. Use the up and down arrows to set which level takes priority.
- Apply and check. Click OK. Scroll through the result and confirm that each row still holds the same values together — a name next to its own phone number, for example.
- For a manual order, drag with Shift. Select the entire row by clicking its row number, hold Shift, then drag the row's border to its new position. Excel inserts it between existing rows rather than overwriting them. To move a column, select the column header, hold Shift, and drag the border.
- To hide rather than move rows, use a filter. Select the table, go to Data > Filter, click the arrow on a column header, and untick the values you do not want. The rows are hidden, not deleted, and clearing the filter restores them.
Common Mistakes
- Sorting a single column. This is the classic data-corruption mistake: names get rearranged while the phone numbers beside them stay put. Always sort the whole table.
- Leaving blank rows inside the data. Excel stops at the gap, so half the table is sorted and half is not. Remove blank rows before sorting.
- Forgetting the header tick box. Your column titles end up somewhere in the middle of the sorted list.
- Sorting formatted cells as text. Numbers stored as text sort as 1, 10, 2 rather than 1, 2, 10. Convert them to real numbers first.
- Sorting by a column of formulas that reference fixed cells. Relative references can point at the wrong row after a sort. Check a few results, or convert formulas to values if the layout must stay fixed.
- Assuming merged cells will sort cleanly. Merged cells across rows usually block sorting. Unmerge them first.
Tips
- Use a custom list for non-alphabetical order. In the Sort dialog choose Order > Custom List to sort by weekdays, months, or a list you type yourself (for example Low, Medium, High).
- Convert the range to a table with Ctrl+T (Windows) or Cmd+T (Mac). Tables expand automatically as you add rows and keep headers attached during sorts.
- Sort by cell colour or icon using the same Order dropdown if you use conditional formatting to flag values.
- Use Ctrl+Z immediately if a sort looks wrong; it undoes the whole operation in one step.
- For a permanent ranking column, add a numbered helper column and sort by it to return to the original order at any time.
Troubleshooting
- Only part of the table moved. A blank row or column split the range. Delete the gap, reselect the full block, and sort again.
- The header row sorted into the data. Press Ctrl+Z, reopen Data > Sort, and tick My data has headers.
- Numbers sort oddly (1, 10, 2). They are stored as text. Select the column, use Data > Text to Columns and finish the wizard, or multiply by 1 in a helper column and paste the values back.
- Dates sort as text. Check the cell format is Date, not Text, then re-enter or convert the values.
- The Sort button is greyed out. The sheet may be protected, or the workbook may be in a shared or read-only state. Unprotect the sheet (Review > Unprotect Sheet) if you have the password, or save a local copy.
- Formulas now show wrong results. Undo the sort and check for absolute references ($A$1) versus relative ones before sorting again.
Frequently Asked Questions
Does sorting in Excel move entire rows?
Yes, when you select the whole table or click a single cell inside it. Excel keeps each row's values together. It only breaks rows apart if you select one column on its own.
Can I undo a sort after saving and closing the file?
No. Undo history is cleared when the file closes. That is why a duplicate sheet or backup copy before sorting is worth the ten seconds it takes.
How do I put rows back in their original order?
If you added a numbered helper column before sorting, sort by that column. Otherwise, restore from your backup copy or use version history if the file is stored in OneDrive or SharePoint.
What is the difference between Sort and Filter?
Sort changes the order of rows. Filter hides rows that do not match your criteria without changing their order. Use Filter when you want to view a subset and keep the full data intact.
Can I sort by more than one column?
Yes. In Data > Sort, click Add Level for each additional column and set the priority with the arrow buttons.
Why does sorting break my merged cells?
Merged cells spanning multiple rows cannot move as a unit. Unmerge them (Home > Merge & Center), fill the values into each row, and sort again.