Home  /  Blog  /  Date & Text
Date & Text

Extract Text After a Character in Excel — With Examples (TEXTAFTER, TEXTBEFORE, FIND)

By admin 30 November 2026 Date & Text

Your cell says “sara.ahmed@example.com” and you need “example.com”. Or “SKU-10492-Blue” and you need “Blue”. Or “David Lee Carter” and you need “Carter”, the last word. That is what TEXTAFTER does — it returns everything after a character you name. Its twin, TEXTBEFORE, returns everything before it. This guide gives you both formulas first, then runs them on the same emails, codes, names and URLs, so you can check each answer yourself — plus the instance-number trick for the second comma and the last word, the #N/A case, and the older-Excel method with FIND for when TEXTAFTER does not exist.

Quick takeaway: TEXTAFTER keeps what is after; TEXTBEFORE keeps what is before.

  • =TEXTAFTER(A2, "@") — everything after the @. =TEXTBEFORE(A2, "@") — everything before it.
  • The third number picks which one: , 2 is the second comma, , -1 counts from the end.
  • Missing character? #N/A — use the if_not_found argument to control it.
  • Older Excel: =LEFT(A2, FIND(" ", A2) - 1) for the first name.
  • FIND is case-sensitive; SEARCH is not.
Extract Text After a Character in Excel — With Examples (TEXTAFTER, TEXTBEFORE, FIND)

The Formulas — Two Functions, One Cut

=TEXTAFTER(text, delimiter)
=TEXTBEFORE(text, delimiter)
FunctionKeepsExampleResult
TEXTAFTEREverything after the delimiter=TEXTAFTER("sara.ahmed@example.com", "@")example.com
TEXTBEFOREEverything before the delimiter=TEXTBEFORE("sara.ahmed@example.com", "@")sara.ahmed

Both are available in Microsoft 365, Excel 2021 and Excel 2024. The delimiter is the character you cut at — an @, a dash, a comma, a space, a slash. The delimiter itself is not in the result.

The Worked Table — Emails, Codes, Names, URLs

Every example below uses the same six texts. Every result was checked against them.

Text in A2TEXTAFTERTEXTBEFORE
sara.ahmed@example.com (cut at @)example.comsara.ahmed
SKU-10492-Blue (cut at -)10492-BlueSKU
David Lee (cut at space)LeeDavid
Laptop, 45, In Stock (cut at ,)45, In StockLaptop
https://example.com/archive/report (cut at /)example.com/archive/reporthttps:

Read the rows. TEXTAFTER on the email gives the domain; TEXTBEFORE gives the username. On the product code, TEXTAFTER gives everything after the first dash — “10492-Blue”, not just “10492” — because the function cuts at the first dash and keeps the rest. And the URL row shows the edge case: cutting at “/” gives “https:” before it, because the first slash in “https://” is part of the “https:” — the cut happens at the first slash it finds, even when that slash belongs to the “://” itself.

The Second Comma and the Last Word — The Instance Number

The third argument picks which occurrence of the delimiter to cut at. A positive number counts from the start; a negative number counts from the end.

GoalFormulaResult
After the second dash=TEXTAFTER("SKU-10492-Blue", "-", 2)Blue
After the second comma=TEXTAFTER("Laptop, 45, In Stock", ",", 2)In Stock
The last word=TEXTAFTER("David Lee Carter", " ", -1)Carter
After the last slash=TEXTAFTER("https://example.com/archive/report", "/", -1)report
Before the last slash=TEXTBEFORE("https://example.com/archive/report", "/", -1)https://example.com/archive

Two notes. First, the comma row: the result is ” In Stock” with a leading space, because the text has a space after the comma — wrap the formula in TRIM() to clean it: =TRIM(TEXTAFTER(A2, ",", 2)) gives “In Stock”. Second, the last two rows are the pair to study: the same URL, cut at the last slash, gives “report” after it and “https://example.com/archive” before it — the two halves of the same cut.

When the Character Is Missing — #N/A and if_not_found

TEXTBEFORE and TEXTAFTER return #N/A when the character is not in the text. That is useful — it tells you the character is not there — but in a column of mixed data it fills the sheet with errors. The if_not_found argument, the last one, controls it:

=TEXTAFTER(A2, "@", 1, 0, 0, "No @ found")
TextFormulaResult
sara.ahmed@example.com=TEXTAFTER(A2, "@", 1, 0, 0, "No @ found")example.com
sara.ahmed (no @)=TEXTAFTER(A2, "@", 1, 0, 0, "No @ found")No @ found
sara.ahmed (no @)=TEXTAFTER(A2, "@")#N/A

The middle arguments are the instance number (1), match mode (0) and match end (0) — the defaults — and the last one is the text to return instead of the error. Use “” for a blank instead of an error, or a word that says what is missing.

The Older Method — LEFT, RIGHT, LEN and FIND

In older Excel without TEXTBEFORE and TEXTAFTER, combine the classic functions. FIND returns the position of the delimiter, and LEFT or RIGHT cuts at it.

GoalFormulaResult
First name from “David Lee”=LEFT(A2, FIND(" ", A2) - 1)David
Last name from “David Lee”=RIGHT(A2, LEN(A2) - FIND(" ", A2))Lee
Position of the last slash=LEN(TEXTBEFORE(A2, "/", -1)) + 128
Position of the last slash (all versions)=FIND("@", SUBSTITUTE(A2, "/", "@", LEN(A2) - LEN(SUBSTITUTE(A2, "/", ""))))28

Work the first row by hand: FIND(” “, “David Lee”) is 6, because the space is the 6th character. LEFT takes 6 − 1 = 5 characters — “David”. The last-name row works the other way: LEN is 9, FIND is 6, so RIGHT takes 9 − 6 = 3 characters from the end — “Lee”. And the last-slash rows: the URL “https://example.com/archive/report” is 34 characters, and the text before the last slash is 27 characters, so the slash is at position 28. The SUBSTITUTE version works in every version: it counts the slashes, replaces the last one with “@”, and finds the “@”.

FIND vs SEARCH — Case Matters

FIND is case-sensitive. SEARCH is not. For a delimiter like @ or – or /, that never matters — but for a letter, it does.

FormulaResultWhy
=FIND("a", "Apple")#VALUE!FIND is case-sensitive — “Apple” has no lowercase a
=SEARCH("a", "Apple")1SEARCH ignores case — the A is at position 1
=FIND("a", "Banana")2The lowercase a is at position 2

For delimiter work, FIND is the usual choice — the delimiter is almost always a symbol, and symbols have no case. Use SEARCH when the delimiter is a letter whose case might vary.

The Middle Piece — Between Two Delimiters

Nest the two functions to take what sits between two characters. For the code “SKU-10492-Blue”, the middle piece is “10492”:

=TEXTBEFORE(TEXTAFTER(A2, "-"), "-")
StepFormulaResult
After the first dash=TEXTAFTER(A2, "-")10492-Blue
Before the next dash=TEXTBEFORE(TEXTAFTER(A2, "-"), "-")10492

TEXTAFTER cuts at the first dash and keeps “10492-Blue”; TEXTBEFORE then cuts that at the next dash and keeps “10492”. The same nesting gives the username of an email, the domain of a URL, or the second item of a comma-separated list.

Common Mistakes

MistakeWhat happensFix
You used TEXTAFTER in old Excel#NAME? — the function does not exist thereUse LEFT/RIGHT with FIND, or the padding method
You forgot the character is missing#N/A fills the columnUse the if_not_found argument
You cut at the first dash, not the second“10492-Blue” instead of “Blue”Add the instance number: =TEXTAFTER(A2, "-", 2)
You forgot the space after the comma” In Stock” with a leading spaceWrap the formula in TRIM()
You used FIND on a letter, wrong case#VALUE! — FIND is case-sensitiveUse SEARCH, or match the case
You used the padding method without TRIMThe result has extra spacesTRIM() the result
You expected TEXTBEFORE to include the delimiterIt does not — the delimiter is never in the resultAdd it back with & if you need it: =TEXTBEFORE(A2, "@") & "@"

Frequently Asked Questions

How do I extract text after a character in Excel? =TEXTAFTER(A2, "@") — everything after the character. For example, on “sara.ahmed@example.com” it gives “example.com”.

How do I extract text before a character in Excel? =TEXTBEFORE(A2, "@") — everything before the character. On the same email it gives “sara.ahmed”.

How do I get the text after the second comma? =TEXTAFTER(A2, ",", 2) — the third argument is the instance number. A negative number counts from the end: =TEXTAFTER(A2, " ", -1) gives the last word.

How do I get the last word in a cell? =TEXTAFTER(A2, " ", -1) — the -1 counts the space from the end, so it cuts at the last space.

Why does TEXTAFTER return #N/A? The character is not in the text. Use the if_not_found argument to return a word or a blank instead: =TEXTAFTER(A2, "@", 1, 0, 0, "No @ found").

What is the difference between FIND and SEARCH? FIND is case-sensitive; SEARCH is not. =FIND("a", "Apple") gives #VALUE!, while =SEARCH("a", "Apple") gives 1.

How do I extract text after a character in older Excel? =RIGHT(A2, LEN(A2) - FIND(" ", A2)) for the text after a space, or =LEFT(A2, FIND(" ", A2) - 1) for the text before it. FIND gives the position, and LEFT or RIGHT cuts at it.

That is how to extract text after a character in Excel: TEXTAFTER keeps what is after the character, TEXTBEFORE keeps what is before it — =TEXTAFTER(A2, "@") gives “example.com” and =TEXTBEFORE(A2, "@") gives “sara.ahmed”, from the same email. On the texts in this guide, that one pair answers every question: the second dash gives “Blue”, the second comma gives “In Stock”, the last space gives “Carter”, and the last slash gives “report”. Remember the two things that catch everyone once: the third argument picks which occurrence — a minus counts from the end — and a missing character gives #N/A, not a blank, unless you use if_not_found. When TEXTAFTER does not exist, FIND gives the position and LEFT or RIGHT cuts at it — “David” is =LEFT(A2, FIND(" ", A2) - 1), and “Lee” is =RIGHT(A2, LEN(A2) - FIND(" ", A2)). From here, the next functions worth learning are the ones this one sits next to — the extract numbers from text guide for the digits inside the same cells, the combine text guide for joining pieces back together — and the full learning order for the whole site is on the Excel Formulas hub and the Date & Text topic page.


About admin

Author of Excel formula guides on this blog.

View all guides by admin →

Keep Learning

Related guides