SEQUENCE function
The SEQUENCE function in Excel generates an array of sequential numbers, either vertically (in a column) or horizontally (in a row). It is useful when you need to create a range of numbers for data analysis, filling columns or rows with a series of values.
Syntax
=SEQUENCE(rows, [columns], [start], [step])
Parameters
- rows (required): The number of rows in the output array (how many numbers you want vertically).
- columns (optional): The number of columns in the output array (how many numbers you want horizontally). Default is
1if not specified. - start (optional): The first number in the sequence. Default is
1if not specified. - step (optional): The increment between each number in the sequence. Default is
1if not specified.
Key Features
- Array Output: Automatically “spills” the result into adjacent cells.
- Flexible Range: Can generate sequences with custom starting points and steps.
- Dynamic: Will automatically adjust if you change the parameters.
Examples
- Generate a sequence of 5 numbers starting from 1 (default step is 1):
=SEQUENCE(5)Result:
1 2 3 4 5 - Generate a sequence of 5 numbers starting from 10 with a step of 2:
=SEQUENCE(5, 1, 10, 2)Result:
10 12 14 16 18 - Generate a sequence of 3 rows and 4 columns, starting from 1 and stepping by 1:
=SEQUENCE(3, 4)Result:
1 2 3 4 5 6 7 8 9 10 11 12 - Generate a sequence of 3 rows and 3 columns, starting from 0 and stepping by 0.5:
=SEQUENCE(3, 3, 0, 0.5)Result:
0 0.5 1 1.5 2 2.5 3 3.5 4
Notes
- Spilled Array: When you use
SEQUENCE, it “spills” the output into adjacent cells. Ensure that the target range is empty to avoid a#SPILL!error. - Negative Numbers: You can generate sequences with negative values by using negative values for the
startorstepparameters. - Dynamic Updates: If you change the arguments (e.g., the number of rows), the array will update automatically.
Related Functions
SEQUENCEvs.ROW:ROWcan be used to generate sequential numbers, but it requires more manual setup.SEQUENCEis more efficient for generating arrays.RANDARRAY: Generates an array of random numbers, but with customizable ranges and decimals.SORT: Used to sort data; can be useful in conjunction withSEQUENCEto sort a generated sequence.FILTER: Filters arrays based on criteria and can be used withSEQUENCEfor advanced scenarios.
The SEQUENCE function is great for quickly filling ranges with consecutive numbers, making it useful for simulations, data entry, and other scenarios where you need ordered data.