Excel TEXTAFTER
Stop wrestling with text. Start grabbing exactly what you need.
What Even IS TEXTAFTER?
Alright, picture this. You’ve got a column of emails like “john.doe@company.com” and you just want the domain part. Or you have product codes like “ABC-123-XYZ” and you need the bit after the second dash. Before TEXTAFTER, you’d use a nightmare of FIND, MID, LEN, and maybe a prayer. Now? One function. Done.
The Basic Idea
TEXTAFTER needs three main things:
- The text — the big string you’re searching in
- The delimiter — the character (or word) that marks where the “after” starts
- (Optional) instance number — which occurrence of the delimiter to use (1st, 2nd, etc.)
That’s it. You give it a string, you tell it “give me everything after the comma” and it does exactly that.
The Structure (It’s Cute)
Don’t panic about all those brackets — 90% of the time you’ll only use the first two. The others are just for special cases.
Why Should You Care?
| Without TEXTAFTER | With TEXTAFTER |
|---|---|
| =MID(A1,FIND(“@”,A1)+1,100) | =TEXTAFTER(A1,”@”) |
| =MID(A1,FIND(“|”,A1)+1,FIND(“|”,A1,FIND(“|”,A1)+1)-FIND(“|”,A1)-1) | =TEXTAFTER(A1,”|”,2) |
| If delimiter not found? #VALUE! error | You can return “not found” cleanly |
| Your boss stares at your screen | Your boss nods approvingly |
Easy Warming Up
Example 1: Grab the Domain from an Email
You have “sarah@coolcompany.com” and you just want “coolcompany.com”.
→ “coolcompany.com”
That’s it. No FIND, no MID, no counting characters. Just “give me the stuff after the @”.
Example 2: Last Name from “First, Last”
You’ve got “Maria, Sanchez” and you need “Sanchez”.
Notice the delimiter is a comma AND a space. TEXTAFTER handles multiple characters, no problem.
Example 3: File Extension from a Filename
You have “report_final.pdf” and you want the extension.
If you had “image.jpg” it would give you “jpg”. Simple.
Medium Getting the Hang of It
Example 1: Second Part After a Dash
Product codes: “A-123-X7”, “B-456-Z9”. You want the middle part (the number).
=TEXTAFTER(“B-456-Z9”, “-“, 2) → “456”
That third argument (the 2) tells Excel “skip the first dash, give me everything after the second dash”.
Example 2: Extract the Last Word
You have a sentence like “I love Excel” and you want the last word.
Using -1 as the instance number tells Excel “start from the end and go backwards”. So it finds the last space and gives you everything after it. Mind. Blown.
Example 3: What If the Delimiter Isn’t There?
You’re looking for a slash in “NoSlashHere” — you don’t want an ugly #VALUE! error.
→ “not found”
That last argument is the “if not found” value. Instead of crashing, it just gives you a friendly message. You’re welcome.
Hard Now We’re Cooking
Example 1: Extract Text Between Two Delimiters
You have “Start [secret] End” and you want just “secret” (the part between brackets). TEXTAFTER can’t do this alone, but we can use it with TEXTAFTER. Wait, that sounds weird — I mean, we use TEXTAFTER twice, once to find the first bracket, then again on that result.
→ “secret”
Let’s break it down: the inner TEXTAFTER grabs everything after the “[” (that gives us “secret] End”). The outer TEXTAFTER then grabs everything after the “]”, leaving us with “secret”. Boom.
Example 2: Extract the Last Part of a Path
File paths: “C:\Users\Maria\Documents\report.xlsx”. You want just the filename.
→ “report.xlsx”
Using -1 again! It finds the last backslash and gives you everything after it. Perfect for paths, URLs, or any situation where you want the final segment.
Example 3: Case-Insensitive Matching
Sometimes your delimiter might be uppercase or lowercase. TEXTAFTER can ignore case if you tell it to.
→ “” (empty, because it matches case-insensitively)
That fourth argument (match_mode) — 1 means “ignore case”. So it finds “WORLD” even though we searched for “world”. The result is empty because there’s nothing after “WORLD” in that string, but hey, no error.
Cheat Sheet: The Rules
- TEXTAFTER is case-sensitive by default. If you search for “a” it won’t find “A”. Use the match_mode argument (set to 1) if you want to ignore case.
- Instance number can be negative. That means “search from the end”. Super useful for last names, file extensions, etc.
- If the delimiter isn’t found and you don’t provide an “if_not_found” value, you’ll get #VALUE!. Always include it if your data might be messy.
- You can combine TEXTAFTER with TEXTAFTER (or with other text functions). Nesting is your friend for complex extractions.
- TEXTAFTER works with arrays too. If you have a column of emails, you can write =TEXTAFTER(A1:A100,”@”) and it will spill down all the domains. That’s the dynamic array magic.
Stuff You’ll Probably Mess Up (It’s Cool, We All Do)
- Forgetting the delimiter. You type =TEXTAFTER(A1) and Excel yells at you. It needs two things: text AND delimiter.
- Using a delimiter that doesn’t exist. And then you get #VALUE! and you’re confused. Add that if_not_found value.
- Thinking instance number starts at 0. Nope. 1 is the first occurrence. 2 is the second. -1 is the last. Count like a normal person.
- Case sensitivity. You search for “cat” and your text has “Cat” — TEXTAFTER doesn’t care unless you tell it to (match_mode=1).
Now You Try
Fire up Excel and try these. Don’t peek at the answers until you’ve given it a shot.
- Extract the username from “user123@domain.com” (hint: you want the part BEFORE the @ — wait, that’s TEXTBEFORE. But you can also use TEXTAFTER with a -1? Actually no, that won’t work. Just use TEXTBEFORE. But hey, now you know both exist.)
- From “2024-05-20”, get the day (the part after the second dash). Use instance number 2.
- From “apple,banana,grape,kiwi”, get the last fruit. Use -1.
- From “Error: file not found”, get “file not found”. Delimiter is “: ” (colon space).
- From “Price: $19.99”, get “19.99”. Delimiter is “$”.
If you can do all five without crying, you’re officially a TEXTAFTER pro. And honestly, that’s a pretty cool skill to have.

Leave a Reply
You must be logged in to post a comment.