Going Stellar

Home/Google Sheets reference

Google Sheets function · Math

SEQUENCE in Google Sheets: syntax and examples

SEQUENCE fills a block of cells with numbers that grow by a fixed step, from one formula in the top-left cell. Rows and columns set the size, start sets the first number, and step the gap. Pair it with ARRAYFORMULA to build dates, labels or row numbers.

Syntax

SEQUENCE(rows, columns, start, step)

Arguments

ArgumentTypeRequiredWhat it does
rowsnumberyesHow many rows to return.
columnsnumbernoHow many columns. Default is 1.
startnumbernoThe first number. Default is 1.
stepnumbernoThe increase between numbers. Default is 1. Can be negative.

Examples

The examples use this table, starting in A1:

n
1
=SEQUENCE(5)

Result:

1
2
3
4
5

Five numbers in a column.

Run in a Google Sheet (English US locale) on .

=SEQUENCE(2, 3)

Result:

123
456

A grid of 2 rows and 3 columns, filled left to right.

Run in a Google Sheet (English US locale) on .

=SEQUENCE(3, 1, 10, 5)

Result:

10
15
20

Start at 10 and add 5 each time.

Run in a Google Sheet (English US locale) on .

=SEQUENCE(1, 4, 100, -25)

Result:

100755025

One row counting down: a negative step.

Run in a Google Sheet (English US locale) on .

=ARRAYFORMULA(SEQUENCE(3)^2)

Result:

1
4
9

Use the sequence in a calculation: the first three squares.

Run in a Google Sheet (English US locale) on .

Common errors

  • rows and columns must be at least 1. SEQUENCE(0) and SEQUENCE(-1) return #NUM!.
  • Inside a calculation, wrap it in ARRAYFORMULA. SEQUENCE(3)+1 on its own shows only the first value, 2.
  • Every size argument must be a number. Text such as "a" returns #VALUE!.
  • Numbers fill row by row, left to right. For a column-first order, swap the sizes and use TRANSPOSE.

Compared with Excel

Same syntax and argument order as Excel SEQUENCE.

Questions and answers

How do I number the rows of a table with SEQUENCE?

Use =SEQUENCE(ROWS(A2:A10)). The size follows the data, so the numbers stay in step when the table changes.

Sources

  1. SEQUENCE (Docs Editors Help)

Markdown version · All functions