Ravindra BagaleCourses & study guides

3. Formulas and Functions

3.9 TEXTBEFORE, TEXTAFTER and TEXTSPLIT

Microsoft 365 / Excel 2024 (not in Excel 2021 or older).

Function Syntax (main arguments) Example on PUN-Kothrud-01 Result
TEXTBEFORE TEXTBEFORE(text, delimiter, [instance_num], …) =TEXTBEFORE(A2,"-") PUN
TEXTAFTER TEXTAFTER(text, delimiter, [instance_num], …) =TEXTAFTER(A2,"-",-1) 01
TEXTSPLIT TEXTSPLIT(text, col_delimiter, [row_delimiter], [ignore_empty], …) =TEXTSPLIT(A2,"-") PUN · Kothrud · 01 (spills into 3 cells)

A negative instance_num counts from the end, so TEXTAFTER(A2,"-",-1) returns the text after the last hyphen.

Worked example – e-mail parts. zoya@example.com: =TEXTBEFORE(A2,"@") → zoya; =TEXTAFTER(A2,"@") → example.com. Full name split: =TEXTSPLIT("Ravindra Bagale"," ") → Ravindra | Bagale.

Ravindra Bagale's Tip

The result of TEXTSPLIT spills (Module 9) – if the cells to the right are not empty, you get #SPILL!. Many students forget this. Keep the space to the right empty before entering the formula. And if your office has Excel 2016/2019, these functions won't work – use FIND + MID there.

Practice task

Split Kothrud, Pune, 411038 into three columns with TEXTSPLIT. Extract the domain from ten e-mail addresses with TEXTAFTER.