1. Home
  2. Functions
  3. Text
  4. TEXTBEFORE

TEXTBEFORE function

Returns the text that comes before a delimiter.

Syntax

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

Arguments

ArgumentRequiredDescription
textRequiredThe text to search
delimiterRequiredThe text that marks the point to cut at (an array gives several delimiters)
instance_numOptionalWhich delimiter to use, from 1 (negative counts from the end; 1 when left out)
match_modeOptional0 match case (default), 1 ignore case
match_endOptional1 treats the end of the text as a delimiter
if_not_foundOptionalThe result when there is no match (#N/A when left out)

How to use TEXTBEFORE

TEXTBEFORE takes 2 required arguments and 4 optional arguments. Type =TEXTBEFORE( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.

Examples

Each result below was calculated by the SheetsBat formula engine.

=TEXTBEFORE("Little Red Riding Hood", " ")Result "Little"
=TEXTBEFORE("Little Red Riding Hood", " ", -1)Result "Little Red Riding"
=TEXTBEFORE("abc", "x")Result #N/A

Every formula, right in your browser

SheetsBat calculates 536 functions, with charts, pivot tables and live collaboration. Free to start.