Skip to Content

TEXTBEFORE

Returns text that occurs before a given character or string

Syntax

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

Parameters

  • text: Required. The text you are searching within
  • delimiter: Required. The text that marks the point before which you want to extract
  • instance_num: Optional. The instance of the delimiter before which you want to extract text (default 1)
  • match_mode: Optional. 0=case-sensitive (default), 1=case-insensitive
  • match_end: Optional. 0=don't match end (default), 1=match against the end of text
  • if_not_found: Optional. Value returned if no match is found

Example

=TEXTBEFORE("Red-Blue-Green", "-")
Returns: StringSince: Microsoft 365