Ravindra BagaleCourses & study guides मराठी Track your progress

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)

About this data: Teaching sample for a fictional shop “GreenField Dairy”. Figures and names (e.g. Priya Deshmukh) are made up for this lesson on textbefore textafter and textsplit.

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.

Loading practice tasks...

  1. City code (Easy): Get the text before "-" in A2.
  2. Email user name (Easy): Get the text before "@" in A3.
  3. UK shop: country code (Easy): Get the text before "-" in Shop!A2.
  4. UK shop: email domain (Easy): Get the text after "@" in Shop!A3.
  5. Email domain (Medium): Get the text after "@" in A3.
  6. First name (Medium): Get the first name from A4.
  7. UK shop: shoe size (Medium): Get the text after the last "-" in Shop!A2.
  8. Store number (Hard): Get the text after the last "-" in A2.
  9. Area name (Hard): Get Kothrud from A2.
  10. UK shop: product (Hard): Get SHOE from Shop!A2.

Quick revision cards

Three standalone cards. Each one explains the idea with its own example. Scan the QR to open this lesson.

Revision card 1: What is Textbefore Textafter And Textsplit?
Card 1: What is Textbefore Textafter And Textsplit? · Download PNG
Revision card 2: Tiny example — Textbefore Textafter And Textsplit
Card 2: Tiny example — Textbefore Textafter And Textsplit · Download PNG
Revision card 3: Checklist — Textbefore Textafter And Textsplit
Card 3: Checklist — Textbefore Textafter And Textsplit · Download PNG