ID EN
#Dynamic array

SEQUENCE

Excel Functions

Get array of list of sequential numbers

Syntax

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

Arguments

Parameter Description
rows Number of rows to return.
columns [optional] Number of columns to return.
start [optional] Starting value (defaults to 1).
step [optional] Increment between each value (defaults to 1).

Return Value

Array of sequential values

Details

The SEQUENCE function generates a list of sequential numbers in an array. The array can be one-dimensional, or two-dimensional, controlled by rows and columns arguments. SEQUENCE can be used on its own to create an array of sequential numbers that spill directly on the worksheet. It can also be used to generate a numeric array inside another formula, a requirement that comes up frequently in more advanced formulas. The SEQUENCE function takes four arguments: rows, columns, start, and step. All values default to 1. The rows and columns arguments control the number of rows and columns that should be generated in the output. For example, the formulas below generate numbers between 1 and 5 in rows and columns: Note that the output from SEQUENCE is an array of values that will spill into adjace

Examples

Example 1

The SEQUENCE function takes four arguments: rows, columns, start, and step. All values default to 1. The rows and columns arguments control the number

EXCEL
=SEQUENCE(5,1) // returns {1;2;3;4;5} in 5 rows
=SEQUENCE(1,5) // returns {1,2,3,4,5} in 5 columns
Example 2

Note that the output from SEQUENCE is an array of values that will spill into adjacent cells. The formula below will create a 5 x 5 array that contain

EXCEL
=SEQUENCE(5,5) // numbers 1-25 in a 5 x 5 array
Example 3

The syntax for SEQUENCE indicates that rows is required and columns is optional. However, either can be omitted:

EXCEL
=SEQUENCE(5) // returns {1;2;3;4;5} in 5 rows
=SEQUENCE(,5) // returns {1,2,3,4,5} in 5 columns
Example 4

The start argument is the starting point in the numeric sequence, and step controls the increment between each value. Both formulas below use a start

EXCEL
=SEQUENCE(3,1,10,5) // returns {10;15;20} in 3 rows
=SEQUENCE(1,3,10,5) // returns {10,15,20} in 3 columns
Examples

In the example in the screen above, the formula in B4 is:

EXCEL
=SEQUENCE(10,5,0,3)
Positive and negative

SEQUENCE can work with both positive and negative values. To count from -10 to zero in increments of 2 in rows, set rows to 6, columns to 1, start to

EXCEL
=SEQUENCE(6,1,-10,2) // returns {-10;-8;-6;-4;-2;0}

See Also

UNIQUE FILTER SORT SORTBY RANDARRAY SEQUENCE