Excel SEQUENCE function - create a number series automatically

In this tutorial, you will learn how to create a number sequence in Excel with formulas. Additionally, we'll show you how to auto generate a series of Roman numbers and random integers - all by using a new dynamic array SEQUENCE function.

The times when you had to put numbers in sequence in Excel manually are long gone. In modern Excel, you can make a simple number series in a flash with the Auto Fill feature. If you have a more specific task in mind, then use the SEQUENCE function, which is specially designed for this purpose.

Excel SEQUENCE function

The SEQUENCE function in Excel is used to generate an array of sequential numbers such as 1, 2, 3, etc.

It is a new dynamic array function introduced in Microsoft Excel 365. The result is a dynamic array that "spills" into the specified number of rows and columns automatically.

The function has the following syntax:

SEQUENCE(rows, [columns], [start], [step])


Rows (optional) - the number of rows to fill.

Columns (optional) - the number of columns to fill. If omitted, defaults to 1 column.

Start (optional) - the starting number in the sequence. If omitted, defaults to 1.

Step (optional) - the increment for each subsequent value in the sequence. It can be positive or negative.

  • If positive, subsequent values increase, creating an ascending sequence.
  • If negative, subsequent values decrease, producing a descending sequence.
  • If omitted, the step defaults to 1.

Basic formula to create a number sequence in Excel

If you are looking to populate a column of rows with sequential numbers starting at 1, you can use the Excel SEQUENCE function in its simplest form:

To put numbers in a column:


To place numbers in a row:


Where n is the number of elements in the sequence.

For example, to populate a column with 10 incremental numbers, type the below formula in the first cell (A2 in our case) and press the Enter key:


The results will spill in the other rows automatically.
Creating a 1 column sequence with a formula

To make a horizontal sequence, set the rows argument to 1 (or omit it) and define the number of columns, 8 in our case:


Formula to generate a horizontal sequence

If you'd like to fill a range of cells with sequential numbers, then define both the rows and columns arguments. For instance, to populate 5 rows and 3 columns, you'd use this formula:


Using the SEQUENCE function to fill a range of cells

To start with a specific number, say 100, supply that number in the 3rd argument:


A sequence starting at a specific number

To generate a list of numbers with a specific increment step, define the step in the 4th argument, 10 in our case:


A sequence incrementing by a specific step

Translated into plain English, our complete formula reads as follows:

Excel SEQUENCE formula

SEQUENCE function - things to remember

To efficiently do a sequence of numbers in Excel, please remember these 4 simple facts:

  • The SEQUENCE function is only available with Microsoft 365 subscriptions. In Excel 2019, Excel 2016 and earlier versions, it does not work since those versions do not support dynamic arrays.
  • If the array of sequential numbers is the final result, Excel outputs all the numbers automatically in a so-called spill range. So, be sure you have enough empty cells down and to the right of the cell where you enter the formula, otherwise a #SPILL error will occur.
  • The resulting array can be one-dimensional or two-dimensional, depending on how you configure the rows and columns arguments.
  • Any optional argument that is not set defaults to 1.

How to create a number sequence in Excel - formula examples

Though the basic SEQUENCE formula does not look very exciting, when combined with other functions, it takes on a whole new level of usefulness.

Make a decreasing (descending) sequence in Excel

To generate a descending sequential series, such that each subsequent value is less than the preceding one, supply a negative number for the step argument.

For example, to create a list of numbers starting at 10 and decreasing by 1, use this formula:

=SEQUENCE(10, 1, 10, -1)

Formula to Make a decreasing sequence in Excel

Force a two-dimensional sequence to move vertically top to bottom

When populating a range of cells with sequential numbers, by default, the series always goes horizontally across the first row and then down to the next row, just like reading a book from left to right. To get it to propagate vertically, i.e. top to bottom across the first column and then right to the next column, nest SEQUENCE in the TRANSPOSE function. Please note that TRANSPOSE swaps rows and columns, so you should specify them in the reverse order:

TRANSPOSE(SEQUENCE(columns, rows, start, step))

For example, to fill 5 rows and 3 columns with sequential numbers starting at 100 and incremented by 10, the formula takes this form:

=TRANSPOSE(SEQUENCE(3, 5, 100, 10))

To better understand the approach, please have a look at the screenshot below. Here, we input all the parameters in separate cells (E1:E4) and create 2 sequences with the below formulas. Please pay attention rows and columns are supplied in different order!

Sequence that moves vertically top to bottom (row-wise):


Regular sequence that moves horizontally left to right (column-wise):

=SEQUENCE(E1, E2, E3, E4)

A formula to generate a two-dimensional sequence that moves vertically

Create a sequence of Roman numbers

Need a Roman number sequence for some task, or just for fun? That's easy! Build a regular SEQUENCE formula and warp it in the ROMAN function. For example:


Where B1 is the number of rows, B2 is the number of columns, B3 is the start number and B4 is the step.
Creating a sequence of Roman numbers

Generate an increasing or decreasing sequence of random numbers

As you probably know, in Excel 365 there is a special function for generating random numbers, RANDARRAY, which we discussed a few articles ago. This function can do a lot of useful things, but in our case it cannot help. To generate either an ascending or descending series of random whole numbers, we'll be needing the good old RANDBETWEEN function for the step argument of SEQUENCE.

For example, to create a series of increasing random numbers that spills in as many rows and columns as specified in B1 and B2, respectively, and start at the integer in B3, the formula goes as follows:


Depending on whether you want a smaller or bigger step, supply a lower or higher number for the second argument of RANDBETWEEN.
Formula to generate a series of increasing random integers

To make a sequence of decreasing random numbers, the step should be negative, so you put the minus sign before the RANDBETWEEN function:


Formula to create a series of decreasing random integers

Note. Because the Excel RANDBETWEEN function is volatile, it will generate new random values with every change in your worksheet. As the result, your sequence of random numbers will be continuously changing. To prevent this from happening, you can use Excel's Paste Special > Values feature to replace formulas with values.

Excel SEQUENCE function missing

Like any other dynamic array function, SEQUENCE is only available in the latest builds of Excel 365 that support dynamic arrays. Therefore, you won't find any of those functions in pre-dynamic Excel such as Excel 2019, Excel 2016, and lower.

That's how to create sequence in Excel 365 with formulas. I hope the examples were both useful and fun. Anyway, thank you for reading and hope to see you on our blog next week!

Practice workbook for download

Excel SEQUENCE formula examples (.xlsx file)

You may also be interested in

44 responses to "Excel SEQUENCE function - create a number series automatically"

  1. tom says:

    help solve this, how many times 1 &2 appear in a column of 2,3,4 upto 20?
    1 1 2 2
    1 2 1 2
    1 1 1 1 2 2 2 2
    1 1 2 2 1 1 2 2
    1 2 1 2 1 2 1 2

    1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2
    1 1 1 1 2 2 2 2 1 1 1 1 2 2 2 2
    1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2
    1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2

    how can i get formula to know how many times a number can appear in a column before being exhausted or repeated.

    • Hello!
      If I understand your task correctly, here is the article that may be helpful to you - COUNTIF in Excel.
      If this is not what you wanted, please describe your task in more detail. Please specify what you were trying to find. Give an example of the source data and the expected result.
      It’ll help me understand it better and find a solution for you

  2. Qasim says:

    Sir I want generate the series of mobile phone numbers like +92301230000 to +92301239999 I don't know how I can.

  3. Simon Sommerville says:

    Interesting piece! I am creating a spreadsheet for my wife who is a potter. All pieces, let's say 'started', are listed in the spreadsheet starting 1 and obviously going down the sheet 2,3,4 etc. However, owing to the nature of her activity, not all pieces get to the point of being saleable items - thus, the final product codes for the saleable items are also consecutive, but there might be gaps between rows, where certain pieces are rejected i.e. product code 0001,0002, gap, gap, gap, 0003 etc. Is it possible, perhaps using a second column next to the Product Code column to use something like an IFISBLANK to work with SEQUENCE, so that, for example a Y (for yes) can be added to the first column, which then lets SEQUENCE add in the next column, the next sequential product code number - if that makes sense ?

    • Hello!
      If you want to create automatic numbering in a column, write 1 in cell C1, and the formula in cell C2:


      After that you can copy this formula down along the column.
      You can make some of the cells in column C blank. The numbering will continue from the next nonblank cell.
      I hope I answered your question. If something is still unclear, please feel free to ask.

  4. Sonny says:

    I want a generate a sequence of numbers in order from 1 to 25. But have them starting again from 1 after 25. How would I modify this formula to satisfy this.

    • Ahmed Alsharif says:

      I have the same , I need to have a sequence number generated automatically and continuance from page one to the next page ... I need to use this sequence as an order number so every time I place an order I have to get an automatic number ... is it possible ?

      thank you & appreciate

    • Hello!
      For automatic line numbering from 1 to 25, use the formula


      After that you can copy this formula down along the column.

  5. Pietro Fiorentini says:

    Hi thank you so much for your informative guidance.
    I have a question. How would the sequence function work in case I wanted to repeat the same number twice?


    Thanks appreciate your help!

  6. Farhan Abr says:

    Sir I want generate the series of mobile phone numbers like 2301230000 to 2301239999 I don't know how I can?

  7. Erin says:

    I am wondering if you can make a sequence where the number changing is not the last character? I want it to be like this, with the stars included? I need it to go from 1-99. Thanks for the help!!


  8. Bob says:

    I'm wondering if anyone could help me.
    I am trying to generate some 1-column sequences like this:

    • Hello!
      If I understand your task correctly, the following formula should work for you:

      =CEILING(ROW(A3001)/3,1)&" - 0"&TRUNC(MOD((ROW(A1)-1)/1,3)+1)

      I hope my advice will help you solve your task.

      • Eric Carmichael says:

        this works great but how do I use a dynamic function with the solution?
        I have 2 numbers set by the user: a1 = 15 and b1 = 3
        from these two inputs I would like to dynamically create a sequence that goes:
        .... until 15.3
        is this possible?

  9. Thomas says:

    I'm trying to generate a sequence of numbers in the below order. Could you please help?

    40000 / 01
    40002 / 03
    40004 / 05
    40006 / 07
    40008 / 09

  10. NABEEL says:

    i want to make a series of 3 digit 'n' numbers
    please help

  11. Becky says:

    Hi, I am looking to take data from one column and create a sequential number in another column. However the data in my reference column (location codes) are duplicated in more than one row but I need my sequential number column to be the same value for each location code. Example: My first entry is Location code K051 that has three rows of data so it's sequential number should be 1 for each of the three rows. Next location code is K052 that has five rows of data so it's sequential number column should be 2 for each of it's 5 rows.
    Each location code could have a varying amount of rows associated.
    Is there a formula that can create these sequential numbers? Thank you!

  12. johan says:

    How can i make sequence of number series with one column or row blank.

    1 2 3 4 5 6
    - - - - - -
    7 8 9 10 11
    - - - - - -

  13. on making a sequence of Admission number in series like says:

    Hi, thank you, Sir Alexander, I'm working on making a sequence of Admission number like
    Please help me, thank you?

  14. Sergio Teixeira says:


    I have a sequence of numbers, let's say:


    and would like Excel to return on a cell(another sheet) the next available number in the given column, starting in 1 to n, if this makes sense.

    Is this possible?

  15. john says:

    i have a sequence of number

    AAA0001 --- AAA9999 , after the 9999 the next number i need is AAB0001 and continue increasement .

    please help , and the alphabet increase is without "I" and "o" .

    thanks !

    • Hi,
      I'm really sorry, we cannot help you with this task. Your task cannot be accomplished with Excel formulas.

      • Eric says:

        I'm spending way too much time on this but who doesn't like a good excel challenge.
        after playing with the start value I was able to make it a bit more elegant
        this solves the no i and o in the letter sequence and skips from 9999 to 0001
        also you can change the number series from 9999 to 999 in P2
        you can drag the top cell across to continue the series in the next column as this series exceeds the max rows allowed in a column.

        =CHAR(65 + MOD(SEQUENCE(1048576,1,(COLUMN()-1)*1048576,1)/(24^2*$P$2),24) + IFS(MOD(SEQUENCE(1048576,1,(COLUMN()-1)*1048576,1)/(24^2*$P$2),24)>12,2,MOD(SEQUENCE(1048576,1,(COLUMN()-1)*1048576,1)/(24^2*$P$2),24)>7,1,TRUE,0)) & CHAR(65 + MOD(SEQUENCE(1048576,1,(COLUMN()-1)*1048576,1)/(24*$P$2),24) + IFS(MOD(SEQUENCE(1048576,1,(COLUMN()-1)*1048576,1)/(24*$P$2),24)>12,2,MOD(SEQUENCE(1048576,1,(COLUMN()-1)*1048576,1)/(24*$P$2),24)>7,1,TRUE,0)) & CHAR(65 + MOD(SEQUENCE(1048576,1,(COLUMN()-1)*1048576,1)/($P$2),24) + IFS(MOD(SEQUENCE(1048576,1,(COLUMN()-1)*1048576,1)/($P$2),24)>12,2,MOD(SEQUENCE(1048576,1,(COLUMN()-1)*1048576,1)/($P$2),24)>7,1,TRUE,0)) & RIGHT("00000" & MOD(SEQUENCE(1048576,1,(COLUMN()-1)*1048576,1),($P$2))+1,LEN($P$2))

    • Eric says:

      ok I have refined my previous answer a little
      set $C$2 to either 999 or 9999 depending on the number series you want
      then use this formula to get the series you asked for.
      No letters i or o and skip from 9999 to 0001

      This was a fun puzzle!!!

      =IF(SEQUENCE(1048576)>$C$2*24^2,"B","A") & CHAR(65 + INT(MOD(SEQUENCE(1048576)/(24*$C$2)- 0.000001,24)) + IFS(INT(MOD(SEQUENCE(1048576)/(24*$C$2)- 0.000001,24))>12,2,INT(MOD(SEQUENCE(1048576)/(24*$C$2)- 0.000001,24))>7,1,TRUE,0)) & CHAR(65 + INT(MOD(SEQUENCE(1048576)/($C$2)- 0.000001,24)) + IFS(INT(MOD(SEQUENCE(1048576)/($C$2)- 0.000001,24))>12,2,INT(MOD(SEQUENCE(1048576)/($C$2)-0.000001,24))>7,1,TRUE,0)) & RIGHT("00000" & ROUNDUP(MOD(SEQUENCE(1048576),($C$2)+0.000001),0),LEN(C2))

      • Eric says:

        for even more fun ;o)
        you can use this formula and drag from a1 to k1 or more
        This will continue the series since column limit in excel doesn't go far enough for your series
        in this case the number series 999 or 9999 is in $M$2

        =CHAR(65 + INT(MOD((SEQUENCE(1048576)+((COLUMN()-1)*1048576))/(24^2*$M$2)- 0.0000001,24)) + IFS(INT(MOD((SEQUENCE(1048576)+((COLUMN()-1)*1048576))/(24^2*$M$2)- 0.0000001,24))>12,2,INT(MOD((SEQUENCE(1048576)+((COLUMN()-1)*1048576))/(24^2*$M$2)- 0.0000001,24))>7,1,TRUE,0)) & CHAR(65 + INT(MOD((SEQUENCE(1048576)+((COLUMN()-1)*1048576))/(24*$M$2)- 0.0000001,24)) + IFS(INT(MOD((SEQUENCE(1048576)+((COLUMN()-1)*1048576))/(24*$M$2)- 0.000001,24))>12,2,INT(MOD((SEQUENCE(1048576)+((COLUMN()-1)*1048576))/(24*$M$2)- 0.000001,24))>7,1,TRUE,0)) & CHAR(65 + INT(MOD((SEQUENCE(1048576)+((COLUMN()-1)*1048576))/($M$2)- 0.000001,24)) + IFS(INT(MOD((SEQUENCE(1048576)+((COLUMN()-1)*1048576))/($M$2)- 0.000001,24))>12,2,INT(MOD((SEQUENCE(1048576)+((COLUMN()-1)*1048576))/($M$2)-0.000001,24))>7,1,TRUE,0)) & RIGHT("00000" & ROUNDUP(MOD((SEQUENCE(1048576)+((COLUMN()-1)*1048576)),($M$2)+0.000001),0),LEN($M$2))

  16. Sergio says:

    I have a sequence of numbers, let's say:


    and would like Excel to return on a cell(another sheet) the next available number in the given column, starting in 1 to n, if this makes sense.

    Is this possible?

    • Hello!
      Write down your numbers starting at cell A2. Write this formula in cell B2


      and then copy it down along the column.
      You can learn more about FILTER function in Excel in this article on our blog.
      Hope this is what you need.

  17. ZOHAIB AHMED says:

    I want to make sequence in different cells i mean selected cells .
    make select cells and put sequence in selected cell .
    not upcoming cell.

Post a comment

Thank you for your comment! When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to your query. We cannot guarantee that we will answer every question, but we'll do our best :)