Excel Tutorials – TEXTAFTER



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.

“TEXTAFTER gives you everything after a specific character (or characters). You tell it where to start looking, and it hands you the rest. Like a bouncer that lets the right people through.”

The Basic Idea

TEXTAFTER needs three main things:

  1. The text — the big string you’re searching in
  2. The delimiter — the character (or word) that marks where the “after” starts
  3. (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)

=TEXTAFTER(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])

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”.

=TEXTAFTER(“sarah@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”.

=TEXTAFTER(“Maria, Sanchez”, “, “) → “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.

=TEXTAFTER(“report_final.pdf”, “.”) → “pdf”

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(“A-123-X7”, “-“, 2) → “123”
=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.

=TEXTAFTER(“I love Excel”, ” “, -1) → “Excel”

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.

=TEXTAFTER(“NoSlashHere”, “/”, 1, 0, 0, “not found”)
→ “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.

=TEXTAFTER(TEXTAFTER(“Start [secret] End”, “[“), “]”)
→ “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.

=TEXTAFTER(“C:\Users\Maria\Documents\report.xlsx”, “\”, -1)
→ “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.

=TEXTAFTER(“HelloWORLD”, “world”, 1, 1)
→ “” (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.

“Match modes are your friend when data isn’t perfectly consistent. Which is always.”

Cheat Sheet: The Rules

  1. 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.
  2. Instance number can be negative. That means “search from the end”. Super useful for last names, file extensions, etc.
  3. 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.
  4. You can combine TEXTAFTER with TEXTAFTER (or with other text functions). Nesting is your friend for complex extractions.
  5. 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.

  1. 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.)
  2. From “2024-05-20”, get the day (the part after the second dash). Use instance number 2.
  3. From “apple,banana,grape,kiwi”, get the last fruit. Use -1.
  4. From “Error: file not found”, get “file not found”. Delimiter is “: ” (colon space).
  5. 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.

“Once you start using TEXTAFTER, you’ll wonder how you ever survived with MID and FIND. It’s like upgrading from a flip phone to a smartphone — you can still make calls, but everything is just easier.”

Leave a Reply