TEXTBEFORE Function in Excel: Text Before a Delimiter

⏱ 1 min readUpdated 28 September 2026

TextLevel: IntermediateAvailable in: Excel 365 / 2021+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Example 2
  5. Example 3
  6. Related functions

TEXTBEFORE returns everything before a delimiter; TEXTAFTER everything after. They replace most LEFT/FIND and MID/FIND combinations.

Syntax

=TEXTBEFORE(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])
Argument What it means
instance_num Which occurrence; negative counts from the end.
if_not_found Result when the delimiter is missing.

Examples

Example 1

=TEXTBEFORE(A2, "@")

Username from an email.

Example 2

=TEXTBEFORE(A2, " ", -1)

Everything except the last word.

Example 3

=TEXTBEFORE(A2, "-", , , , A2)

Whole text if there is no dash.

TEXTAFTER · TEXTSPLIT · LEFT

📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong