Calc TEXTBEFORE function

The TEXTBEFORE function returns the text that occurs before a specified delimiter or occurrence in a text string.

Help CentreFunctions & Formulas

For a full list of available calculation functions, please read What calculation functions are supported.


Description

The TEXTBEFORE function returns the text that occurs before a specified delimiter or occurrence in a text string.


Syntax

TEXTBEFORE(text, delimiter, [instance_num], [match_mode], [match_end])


The TEXTBEFORE function syntax has the following arguments:

  • text: Required. The text string to search within.
  • delimiter: Required. The character or characters that mark the point before which to return text.
  • instance_num: Optional. Specifies which occurrence of the delimiter to use. If omitted, the first occurrence is used.
  • match_mode: Optional. Specifies whether to match case-sensitive or case-insensitive. Default is case-insensitive.
  • match_end: Optional. If TRUE, returns text up to the end of the string; if FALSE, returns text up to the next delimiter.

Example

FormulaDescriptionResult
=TEXTBEFORE("apple, banana, cherry", ", ")Returns text before the first comma and space.apple

Errors

For a full list of formula errors, please read Formula errors.


Related functions

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or go live in 7 days.