Summary
The Excel SEQUENCE function creates an array of sequential numbers, either in a one-dimensional or two-dimensional array. The size of the array is determined by the rows and columns arguments, with options to set the starting value and the step increment between numbers.
Syntax
=SEQUENCE(rows, [columns], [start], [step])
- rows: Number of rows for the array
- [columns]: [Optional] Number of columns for the array. Defaults to 1 if omitted
- [start]: [Optional] Starting value for the sequence. Defaults to 1
- [step]: [Optional] Increment between each value in the sequence. Defaults to 1
Return value
An array of sequential values, arranged as specified by the rows and columns arguments.
How to use
Use SEQUENCE to generate a list of numbers in an orderly sequence. This function can be used to create simple numeric sequences or more complex arrays, suitable for various applications in data analysis, simulations, and more.
Examples
Simple SEQUENCE
Creating a Sequential Number List: To generate a vertical list of numbers from 1 to 5:
=SEQUENCE(5)
This formula produces an array of 5 numbers (1, 2, 3, 4, 5) in a vertical arrangement.
SEQUENCE for Two-Dimensional Arrays
Generating a Two-Dimensional Number Grid: Creating a 3×3 grid of sequential numbers:
=SEQUENCE(3, 3)
This formula creates a 3×3 array, with numbers from 1 to 9 arranged in three rows and three columns.
SEQUENCE with Custom Start and Step
Creating a Custom Sequence: Generating numbers starting from 10, incrementing by 5:
=SEQUENCE(4, 1, 10, 5)
Produces a vertical array: 10, 15, 20, 25.
SEQUENCE for Negative and Positive Ranges
Counting Up and Down with SEQUENCE: Creating a sequence from -5 to 5:
=SEQUENCE(11, 1, -5, 1)
Generates a vertical array from -5 to 5.
MOD with Other Excel Functions
Integrating MOD in Complex Formulas: Combining MOD with IF:
=IF(MOD(A2, 2) = 0, "Even", "Odd")
This formula checks if a value in A2 is even or odd and returns “Even” or “Odd” accordingly.
Additional Notes
- SEQUENCE is particularly useful for creating arrays for testing and analysis purposes, as well as for data visualization in Excel.
- The function automatically spills the results into adjacent cells when there is enough space.