The SEQUENCE function generates dynamic arrays of sequential numbers with customizable start values and increments. Perfect for creating row numbers, indexing, numbering lists, and generating patterned data arrays efficiently.
Master the fundamentals of Excel SEQUENCE function
SEQUENCE generates arrays of sequential numbers with complete control over dimensions, starting value, and increment. It's the modern replacement for complex array formulas and provides efficient dynamic array generation for indexing, numbering, and pattern creation.
Automatically fills adjacent cells with sequential numbers
Fills left to right, then top to bottom
Support for ascending, descending, and custom increments
Only recalculates when inputs change
Function-specific parameters
Function-specific return type
Automatically number rows in dynamic lists
Create index arrays for complex formulas
Generate date sequences and time series
Create numbered lists and sequences
Exact matching required
Returns numeric position
Handles missing text gracefully
=SEQUENCE(rows, columns, start, step)Number of rows to generate (required)
Number of columns to generate (default is 1)
Starting value for the sequence (default is 1)
Increment between values (default is 1)
Dynamic array of sequential numbers
Description: Generates an array of sequential numbers with customizable dimensions and pattern
Generate numbers 1 through 5
Creates a vertical sequence starting from 1
Create SEQUENCE-like functionality in VBA
' Generate sequential array in VBA
Function SequenceVBA(rows As Long, Optional cols As Long = 1, Optional start As Double = 1, Optional step As Double = 1) As Variant
Dim result() As Variant
Dim i As Long, j As Long
Dim counter As Double
ReDim result(1 To rows, 1 To cols)
counter = start
For i = 1 To rows
For j = 1 To cols
result(i, j) = counter
counter = counter + step
Next j
Next i
SequenceVBA = result
End Function
' Usage example
Sub Example_SequenceVBA()
Dim myArray As Variant
myArray = SequenceVBA(5, 3, 1, 1)
Range("A1:C5").Value = myArray
MsgBox "Sequence generated in A1:C5"
End SubGenerate sequences with conditional logic
' Generate even numbers only
Function SequenceEven(rows As Long) As Variant
Dim result() As Variant
Dim i As Long
ReDim result(1 To rows, 1 To 1)
For i = 1 To rows
result(i, 1) = i * 2
Next i
SequenceEven = result
End Function
' Generate sequence with specific pattern
Function SequenceCustom(maxVal As Long) As Variant
Dim result() As Variant
Dim i As Long, count As Long
count = Application.WorksheetFunction.RoundUp(maxVal / 2, 0)
ReDim result(1 To count, 1 To 1)
For i = 1 To count
result(i, 1) = i * 2 - 1 ' Odd numbers only
Next i
SequenceCustom = result
End FunctionAuto-number rows that adjust with filtered data
Create numbered series for reports and lists
Generate index arrays for complex formulas
Combine with DATE function for date series
Generate coordinate matrices and grids
Not enough empty cells for the sequence
Ensure space for rows x columns cellsSolution: Clear cells below or to the right of the formula
Sequence fills in unexpected order
=SEQUENCE(3,2) gives 1,2 then 3,4 then 5,6Solution: Remember SEQUENCE fills row-major (left to right, top to bottom)
Need decimal increments instead of integers
=SEQUENCE(10,1,0,0.5)Solution: Use decimal step values like 0.1 or 0.5
SEQUENCE requires Excel 365 or 2021
Use =ROW(A1:A10) for basic sequencesSolution: Use ROW() function or manual numbering for older versions