Substring
  • 19 May 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

Substring

  • Dark
    Light
  • PDF

Returns a slice of the given text between the given indices.

The slice of text starts at (and includes) the index given as the 2nd parameter. It ends at (and excludes) the index given as the 3rd parameter.

If both indices are the same, the function returns an empty text. Negative indices are counted backwards, starting from the end of the text.

Function signature

SUBSTRING(text: String, start: Number, stop: Number) => String
Parameter Description
Text Text which to get a slice from
Start The index (starting from 0) indicating the first character to include.
Stop The index (starting from 0) indicating the end of the slice. This character will not be included in the result.If omitted, then the rest of the text will be included.

Examples

Formula Return value
SUBSTRING("foo bar", 0, 3) foo
SUBSTRING("foo bar", 4) bar
SUBSTRING("foo bar", 0, -1) foo ba

Was this article helpful?

What's Next