TEXTBEFORE Function
Return the text before a delimiter. text is searched for delimiter. instance_num selects the occurrence (1 when omitted), counted from the end when it is negative; match_mode 1 makes the search case-insensitive, and match_end 1 treats the end of the text as a delimiter. When the delimiter isn't found, TEXTBEFORE returns if_not_found, or #N/A when that is omitted.
Syntax
TEXTBEFORE(text, delimiter, instance_num, match_mode, match_end, if_not_found)
Category: Text. Minimum arguments: 2. Maximum arguments: 6.
Available for supported offline calculation.
Examples
=TEXTBEFORE("a/b/c","/",2)
The formula returns a/b, the text before the second slash.
Cell and range examples require appropriate input values in the referenced cells. Handle invalid arguments, formula errors and array and spill constraints.