How to Use TEXTSPLIT, TEXTBEFORE, and TEXTAFTER in Excel
For decades, splitting text with formulas meant combining LEFT, RIGHT, MID, FIND, and LEN into fragile expressions that were painful to debug. Excel’s modern text functions (TEXTBEFORE, TEXTAFTER, and TEXTSPLIT) replace those workarounds with clean, readable formulas that update automatically.
Unlike the static Text to Columns wizard, these functions are fully dynamic and recalculate whenever the source text changes. They are available in Microsoft 365, Excel 2024, and Excel for the Web.
Table of Contents
Quick Overview of the Three Functions
| Function | What It Does | Basic Syntax |
|---|---|---|
TEXTBEFORE |
Extracts text before a specific delimiter. | =TEXTBEFORE(text, delimiter, [instance_num]) |
TEXTAFTER |
Extracts text after a specific delimiter. | =TEXTAFTER(text, delimiter, [instance_num]) |
TEXTSPLIT |
Splits text across multiple columns and/or rows. | =TEXTSPLIT(text, col_delimiter, [row_delimiter]) |
Step-by-Step: Extract Parts of an Email with TEXTBEFORE and TEXTAFTER
Suppose cells A2:A4 contain email addresses: anna.smith@northwind.com, mark.lee@contoso.org, and sara.chen@fabrikam.net.
-
Step 1: Extract the Username Using TEXTBEFORE
Click cell
B2and enter the formula below to capture everything before the@symbol:=TEXTBEFORE(A2, "@")Press
Enter. Excel returnsanna.smith. Drag the formula down toB4. -
Step 2: Extract the Domain Using TEXTAFTER
Click cell
C2and enter the formula below to capture everything after the@symbol:=TEXTAFTER(A2, "@")Press
Enter. Excel returnsnorthwind.com. Drag down toC4. -
Step 3: Search from the End Using a Negative Instance Number
What if you have a file path like
C:\Reports\2026\Q1\Sales.xlsxin cellA6and only want the file name after the last backslash? Set the third argument (instance_num) to-1to count backward from the end:=TEXTAFTER(A6, "\", -1)Press
Enter. Excel immediately returnsSales.xlsx.
Step-by-Step: Split a Cell into Multiple Columns Using TEXTSPLIT
Suppose cell A9 contains a full address string: 742 Evergreen Terrace, Springfield, IL, 62704.
- Click cell
B9and make sure cellsC9:E9to the right are empty so the formula can spill. - Enter the
TEXTSPLITformula using", "(a comma followed by a space) as the column delimiter:=TEXTSPLIT(A9, ", ") - Press
Enter. Excel automatically splits the text across four separate columns:B9:742 Evergreen TerraceC9:SpringfieldD9:ILE9:62704
Step-by-Step: Split Text into a 2D Table (Both Columns and Rows)
TEXTSPLIT can break a single cell into rows and columns simultaneously. Suppose cell A12 holds packed key-value data: Laptop:1200;Monitor:400;Keyboard:85.
- Click cell
B12with empty space below and to the right. - Pass
":"as the col_delimiter and";"as the row_delimiter:=TEXTSPLIT(A12, ":", ";") - Press
Enter. Excel spills a clean 3-row by 2-column table:
| Column B | Column C |
|---|---|
| Laptop | 1200 |
| Monitor | 400 |
| Keyboard | 85 |
Handling Extra Delimiters and Missing Matches
- Ignore empty cells from repeated delimiters: If your text contains double commas like
Apple,,Banana, set the fourth argument (ignore_empty) toTRUE:=TEXTSPLIT(A2, ",", , TRUE) - Prevent #N/A errors when a delimiter is missing: In
TEXTBEFOREandTEXTAFTER, you can provide a custom fallback in the sixth argument (if_not_found):=TEXTBEFORE(A2, "@", 1, 0, 0, "Invalid Email") - Case-insensitive matching: By default, all three functions are case-sensitive. Set the
match_modeargument to1to ignore uppercase and lowercase differences.
When to Use Older Text Formulas Instead
If you share workbooks with colleagues running Excel 2019 or earlier, these three functions will return a #NAME? error. For backward compatibility, use our classic walkthrough on how to cut pieces of text in Excel.



