SEQUENCE

Fill a range with a sequence of numbers — 1 to 10, every 5 from 100, a grid of row by column — from a single formula that spills.

Syntax

SEQUENCE(rows, [columns], [start], [step])
Argument Required Description
rows Required How many rows to fill.
columns Optional How many columns to fill. Defaults to 1.
start Optional The first number. Defaults to 1.
step Optional The amount added each time. Defaults to 1; may be negative or fractional.

Examples

Every example below was executed against VisiGrid engine 0.51.0 — not transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.

Formula Result Notes
=A1 10 SEQUENCE(3,1,10,5) is in A1 and spills down into A2 and A3.
=A3 20 10, 15, 20.
=E1 3 SEQUENCE(1,3) in C1 spills across — 1, 2, 3 in C1:E1.
=SUM(SEQUENCE(100)) 5050 The numbers 1 to 100, added, without a helper column.

One formula, many cells

SEQUENCE returns an array, and the array spills: the formula lives in one cell and the numbers fill the cells below and to the right. Cells in the spill area can be read like any other — =A3 above reads the third number — but only the first cell holds the formula. If something already occupies the spill area, the formula shows #SPILL! instead of overwriting it.

Numbering, schedules, grids

=SEQUENCE(12) numbers twelve rows. =SEQUENCE(12,1,0,30) gives the day offsets of a monthly schedule to add to a start date. =SEQUENCE(3,4) fills a 3-by-4 grid with 1 to 12, row by row.

Because the result is an array, SEQUENCE also works inside another function without ever touching the sheet, as the SUM example shows.

Excel compatibility

Matches Excel for rows, columns, start and step.

Related functions

Last updated