Putting numbers in order in Excel is quick once you know where to look. To sort numbers, select your data, then use Data > Sort (or the Sort & Filter button on the Home tab) and choose Smallest to Largest or Largest to Smallest. To add automatic row numbers, type =ROW()-1 (or =SEQUENCE(n) in newer versions) in the first cell and fill down. Below is the full walkthrough for both, plus how to handle common problems like numbers stored as text.
What You'll Need
- Excel on Windows, Mac, or Excel for the web (menus can differ slightly by version and platform)
- A spreadsheet with a column of numbers to sort or number
Step-by-Step
Part 1: Sort numbers into order
- Click any single cell inside the number column you want to sort. Do not select just one cell if your data spans several columns — Excel needs to detect the surrounding table.
- Go to the Data tab and click Sort. Alternatively, on the Home tab, click Sort & Filter in the Editing group for a quicker option.
- In the Sort dialog, set Sort by to your number column.
- Under Order, choose Smallest to Largest (ascending) or Largest to Smallest (descending).
- Check the box My data has headers if the first row contains column names, so it is not sorted with the data.
- Click OK. The entire table reorders together, keeping each row intact.
Part 2: Add a running number sequence
- Click the first cell where you want numbering to start (for example A2, under a header).
- Type =ROW()-1 and press Enter. This shows the row number minus one, so row 2 displays 1.
- Drag the fill handle (the small square at the bottom-right of the cell) down as far as needed.
- For a fixed-length list in a newer Excel version, type =SEQUENCE(10) instead to spill the numbers 1 to 10 automatically.
- If you prefer plain values over formulas, select the numbered cells, copy them, then use Paste Special > Values to lock them in.
Part 3: Number rows after sorting
- Sort your data first using Part 1.
- Add the numbering formula from Part 2 last, so the numbers reflect the final sorted order.
Common Mistakes
- Sorting only one column: always click a single cell and let Excel auto-detect the table, or select the full range first, so related data does not get separated.
- Numbers stored as text: cells aligned left with a small green triangle are text. Sorting will put them in the wrong place. Select the cells, click the warning icon that appears, and choose Convert to Number.
- Blank rows or columns inside the data: these split your table, so only part gets sorted. Remove gaps before sorting.
- Using ROW()-1 on a header-free sheet: adjust the offset so the first number is 1 where you want it.
- Forgetting to tick My data has headers, which drags the header row into the sort.
Tips
- For a fast one-column sort, select the column and use the AZ↓ / ZA↓ buttons on the Data tab — AZ means ascending for numbers too.
- Use Data > Sort to add multiple levels, for example sort by department, then by amount within each department.
- Ctrl+Z undoes a bad sort instantly — do not save over your original until you are happy with the result.
- To keep numbers static after sorting rows manually, convert formulas to values as described above.
- Format your data as a table (Ctrl+T) so sorts and filters behave predictably.
Troubleshooting
Sort produced odd results? Check for text-formatted numbers (green triangles), blank rows, or merged cells. Convert, delete or unmerge, then re-sort.
Only part of the data moved? Your selection was incomplete. Press Ctrl+Z, then select the full range explicitly before sorting again.
Sort button is greyed out? The sheet may be protected, or you are in the middle of editing a cell. Press Esc to exit edit mode, or unprotect via Review > Unprotect Sheet if you have the password.
Numbering restarts or shows wrong values? If you inserted or deleted rows, the ROW() formula updates automatically — which is usually what you want. If numbers must never change, paste them as values.
SEQUENCE not working? That function needs a newer version of Excel or Excel for the web. Fall back to the ROW() method, which works everywhere.
Frequently Asked Questions
How do I sort numbers from largest to smallest?
Select a cell in the column, go to Data > Sort, and choose Largest to Smallest under Order.
How do I automatically number rows in Excel?
Type =ROW()-1 in the first data cell and fill down, or use =SEQUENCE(n) in newer versions to generate 1 through n in one step.
Why are my numbers sorting alphabetically?
They are stored as text. Select the cells, click the warning triangle icon, and choose Convert to Number, then sort again.
Can I sort numbers without affecting other columns?
Only by selecting that column alone — Excel will warn that it will expand the selection; choose Continue with the current selection. This is risky, as it breaks row relationships, so use it only when the column stands alone.
Will sorting break my formulas?
Formulas that reference other rows move with their rows and keep working. Cross-sheet references can shift, so check key totals after a large sort and undo if anything looks wrong.