TEXTBEFORE in Excel: get the text before a character

By Srini Vanamala / September 29, 2026 / Formulas & Functions
TEXTBEFORE in Excel: get the text before a character

Microsoft 365 and Excel 2024.

Syntax

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

Before the first @

=TEXTBEFORE(A2,"@")

asha@mail.in → asha

First name from a full name

=TEXTBEFORE(A2," ")

Before the 2nd or the last occurrence

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

INV-2026-045 → INV-2026 with either (a negative number counts from the end).

When the delimiter isn’t there

You get #N/A. Return the whole text instead:

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

Ignore upper/lower case

Set match_mode to 1: =TEXTBEFORE(A2,"ref",,1)

Older Excel

=LEFT(A2,FIND("@",A2)-1)

See LEFT and FIND.

The other half: TEXTAFTER · Split into many columns: TEXTSPLIT

← →
Srini Vanamala

20 years with spreadsheets and enterprise systems. Writes one short, plain-English Excel lesson a day. Got an Excel question? learnexceleasycom@gmail.com

Have a question about this lesson?

Ask anything — I read every comment. Your email is never shown.