Excel Formula to List Numbers in Order
In this article
The quickest way to list numbers in order in Excel is to use the SEQUENCE function: type =SEQUENCE(10) in a cell and press Enter to get 1 through 10 in a column. If you need a sorted list of existing numbers rather than a generated sequence, use SORT: =SORT(A2:A20). Both functions spill results automatically in Excel for Microsoft 365, Excel 2021, and Excel for the web. In older versions, use the fill handle to create a series, or the SMALL function with ROW to rank numbers one by one.
What You'll Need
- Excel for Microsoft 365, Excel 2021, Excel for the web, or Excel for Mac 2021 or later for SEQUENCE and SORT. These dynamic array functions are not available in Excel 2019 or earlier.
- A blank cell or column where the results can spill. The formula needs empty space below and to the right; if the spill range is blocked, Excel returns a #SPILL! error.
- If you are sorting existing numbers, have them in a single column or row with no blank rows in the middle.
Step-by-Step
- Generate a simple numbered list. Click an empty cell, type
=SEQUENCE(10), and press Enter. Excel fills ten cells downward with 1 to 10. Change the 10 to however many numbers you need. - Start from a different number. Use the third argument:
=SEQUENCE(10,1,5)starts at 5 and lists 5 through 14. The arguments are rows, columns, start, and step. - Count by twos or any step. Add the fourth argument:
=SEQUENCE(5,1,2,2)returns 2, 4, 6, 8, 10. - List across a row instead of down a column. Set columns to a number and rows to 1:
=SEQUENCE(1,10)spills 1 to 10 horizontally. - Sort existing numbers. If your numbers are in A2:A20, click an empty cell and enter
=SORT(A2:A20). The smallest number appears first. Add 1 as the second argument for ascending order or -1 for descending:=SORT(A2:A20,1,-1). - Sort numbers that sit next to labels. If column A has names and column B has numbers, use
=SORT(A2:B20,2,1). The 2 tells Excel to sort by the second column, and 1 means smallest to largest. The whole rows move together. - Rank numbers without sorting the source. In an empty column next to your data, enter
=SMALL($A$2:$A$20,ROW(A1))and drag down. ROW(A1) returns 1, then 2, and so on, so SMALL pulls the smallest, second smallest, and so on. This works in every Excel version. - Number rows in order without a formula. Type 1 in a cell, type 2 in the cell below, select both, and drag the fill handle down. Excel continues the series. For a quick fill, type 1, hold Ctrl, and drag down.
- Convert the spill to fixed values if needed. Select the spilled range, press Ctrl+C, then right-click and choose Paste Special > Values. This replaces the formula with plain numbers, which is useful before you delete the source data.
Menu labels and function availability can differ slightly by Excel version, platform, and region. The steps above apply to desktop Excel and Excel for the web; on mobile, the formula bar works the same but dragging the fill handle is replaced by a fill option in the cell menu.
Common Mistakes
- #SPILL! error. Something is blocking the cells where the result needs to appear. Clear the cells below and to the right, or move the formula.
- #NAME? error. The version of Excel does not recognise SEQUENCE or SORT. Use the SMALL and ROW method or the fill handle instead.
- Sorting only part of the data. If you select just the number column and sort, the labels next to it stay put and no longer match. Always include the whole table in the SORT range or select all columns before using Data > Sort.
- Numbers stored as text. SORT may place them oddly and SMALL may ignore them. Check for a green triangle in the corner of the cell and convert with Text to Columns or by multiplying by 1.
- Dragging the fill handle with only one cell selected. Excel copies the same number instead of creating a series. Select two cells first or hold Ctrl while dragging.
Tips
- SEQUENCE results update automatically. If you change the count or start value in a referenced cell, the list recalculates.
- Combine SEQUENCE with TEXT to format the list:
=TEXT(SEQUENCE(10),"000")gives 001, 002, and so on. - Use
=SORT(UNIQUE(A2:A20))to remove duplicates and sort in one step. - If you need the order to stay fixed, paste the results as values before editing the source data.
- For a numbered list that grows with your data, use
=SEQUENCE(COUNTA(A2:A1000))so the count adjusts as rows are added.
Troubleshooting
If the formula returns an error, check the version first: SEQUENCE and SORT require a dynamic array version of Excel. If you see #SPILL!, select the cell with the formula and look for the dashed border showing the intended spill range; delete or move anything inside it. If SORT returns the wrong order, confirm the numbers are true numbers, not text, and that the sort index points to the correct column. If SMALL returns #NUM!, the k value from ROW is larger than the number of values in the range, so shorten the drag or adjust the range. If the fill handle copies instead of counting, enter the first two values manually and select both before dragging. Finally, if results look correct but do not refresh, press F9 to recalculate or check that calculation is set to Automatic under Formulas.
Frequently Asked Questions
Can I list numbers in order without sorting the original data?
Yes. Use =SORT(A2:A20) in a separate cell, or use SMALL with ROW to pull values one by one. The source column stays untouched.
Why does SEQUENCE not work in my Excel?
SEQUENCE is a dynamic array function available in Microsoft 365, Excel 2021, and Excel for the web. Excel 2019 and earlier do not have it, so use the fill handle or SMALL instead.
How do I list numbers in descending order?
Use =SORT(A2:A20,1,-1). The -1 sets descending order. For a generated list, use a negative step: =SEQUENCE(10,1,10,-1).
Can I sort numbers that are mixed with text?
SORT handles mixed ranges but places numbers and text according to Excel's sort rules, which may not be what you expect. Keep numbers in their own column for predictable results.
How do I number rows automatically as I add data?
Use =SEQUENCE(COUNTA(A2:A1000)) so the count grows with the data, or convert the range to an Excel Table and add a numbered column with a formula that references the row.
Does sorting with a formula change the original cells?
No. SORT and SEQUENCE return new spilled ranges. The original data stays as it is unless you overwrite it yourself.