Extract everything before a specific character or word — one formula, no nesting required.
TEXTBEFORE returns the text that appears before a specified delimiter. It replaces the old approach of nesting LEFT with FIND, which was error-prone and hard to read.
TEXTBEFORE(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])| Argument | What it means |
|---|---|
| text required | The text string to extract from. |
| delimiter required | The character or string to search for. |
| instance_num optional | Which occurrence to use. Default is 1 (first). Use -1 for the last occurrence. |
| match_mode optional | 0 = case-sensitive (default), 1 = case-insensitive. |
| if_not_found optional | What to return if delimiter isn't found. Defaults to #N/A. |
=TEXTBEFORE(A2, " ")If A2 contains "Sarah Johnson", this returns "Sarah".
=TEXTBEFORE(A2, "@")If A2 contains "sarah@example.com", this returns "sarah".
=TEXTBEFORE(A2, ",", -1)Use -1 as instance_num to count from the end. Useful for addresses where the last comma separates city from country.
Before TEXTBEFORE, extracting text before a space required: =LEFT(A2, FIND(" ",A2)-1) — and crashed with an error if no space existed. TEXTBEFORE handles missing delimiters gracefully via the if_not_found argument.
Type it in a live spreadsheet, get instant feedback. No videos, no downloads.
Start practising free →