Skip to main content

ARRAY_RANGE

Arnaud Lachaume avatar
Written by Arnaud Lachaume
Updated this week

Type: Function

Function: ARRAY_RANGE

Syntax: ARRAY_RANGE(list, start_index, end_index) or list[start_index..end_index]

Description: Returns the list elements from start_index to end_index. The index starts at zero and goes up to LENGTH(array) - 1. A negative index can be specified to access elements from the end of the list.

Sample usage:​

  • ARRAY_RANGE(["a", "b", "c"], 0, 1) returns ["a", "b"]

    • ["a", "b", "c"][0..1] also returns ["a", "b"]

  • ARRAY_RANGE(["a", "b", "c"], 1, 2) returns ["b", "c"]

  • ARRAY_RANGE(["a", "b", "c"], 1, 3) returns ["b", "c"]

  • ARRAY_RANGE(["a", "b", "c"], -2, -1) returns ["b", "c"]

    • ["a", "b", "c"][-2..-1] also returns ["b", "c"]

  • ARRAY_RANGE(["a", "b", "c"], 0, -1) returns ["a", "b", "c"]

Did this answer your question?