AnalystPracticeGuides
DashboardSign up

TEXTBEFORE and TEXTAFTER: splitting text in new Excel

TEXTBEFORE returns the text before a separator, and TEXTAFTER returns the text after it. They replace the old LEFT, MID and FIND combinations. They are available in Microsoft 365 and Excel for the web.

How do they work?

For the email "ana.petrovic@firma.at" in A2:

FormulaResult
=TEXTBEFORE(A2,"@")ana.petrovic
=TEXTAFTER(A2,"@")firma.at
=TEXTAFTER(A2,".",-1)at

The third argument picks which occurrence to use. A negative number counts from the end.

What happens if the separator is missing?

They return #N/A. Give a fallback as the sixth argument, or wrap the formula in IFNA.

What if I need the old way?

For Excel 2021 or older, the same split is =LEFT(A2,FIND("@",A2)-1) and =MID(A2,FIND("@",A2)+1,LEN(A2)).

Try it yourself. Practise this in a real spreadsheet in your browser, with instant feedback.
Practise TEXTBEFORE and TEXTAFTER

Updated November 2026.

← All free guides