Skip to content

Series

Description

Series returns a sequence of numbers with the desired start value and step size, and an approximate stop value. Both this function and the companion Range function are convenient wrappers for SEQUENCE, meant to relieve you of having to do some mental math to get the sequence you want.

Series is useful for when you want to control the start and step values exactly; Range is useful when you want to specify the start and stop exactly, as well as the number of items.

Syntax

Series(start, stop, [step=1]) where

  • start is the value at the beginning of the sequence
  • stop is the maximum of the last value of the sequence. That last value will never be larger than stop and is guaranteed to be within step of it.
  • step is the step size

The sequence is returned as a column vector. The number of items is determined by the input values.

Example

The example compares the usage of Series and Range.

Series(1,3,0.25) gives 1 to 3 in steps of 0.25 (9 values); Range(1,3,10) gives 10 evenly spaced values from 1 to 3

Download: SeriesRangeSequences.xlsx

Source Code

Series = LAMBDA(
    start, // first number in returned vector
    stop, // max value of final number in returned vector (not to be exceeded)
    [step], // optional step size; default is 1
    LET(
        step, IF(ISOMITTED(step), 1, step),
        length, FLOOR.MATH((stop - start) / step) + 1,
        SEQUENCE(length, 1, start, step)
    )
);