Skip to content

Range

Description

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

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

Syntax

Range(start, stop, length) where

  • start is the value at the beginning of the sequence
  • stop is the last value of the sequence
  • length is the number of items in the sequence.

The step size is chosen to accommodate the inputs. The sequence is returned as a column vector.

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

Range = LAMBDA(start, stop, length, SEQUENCE(length, 1, start, (stop - start) / (length - 1)));