To pull the domain out of an email address — everything after the @ — for grouping contacts by company or filtering, use TEXTAFTER in Excel 365 or the classic MID/FIND in any version.
@ — the domain. The legacy version uses MID and FIND.
The example
Domains pulled from email addresses.
| A | B | |
|---|---|---|
| 1 | Domain | |
| 2 | ana@acme.com | acme.com |
| 3 | ben@bolt.io | bolt.io |
The formula
The domain:
How it works
Split at the @ sign:
TEXTAFTER(A2, "@")returns the text to the right of the@— the full domain including the extension.- In older Excel:
=MID(A2, FIND("@", A2)+1, 100)— start one character after the@and take the rest. - For just the company part (drop
.com):=TEXTBEFORE(TEXTAFTER(A2,"@"), "."). - Group or count by domain with COUNTIF on the extracted column.
Get the username instead: =TEXTBEFORE(A2, "@") (365) or =LEFT(A2, FIND("@",A2)-1) returns everything before the @.
Try it: interactive demo
Type an email; see the domain and username.
Variations
Username (before @)
Everything left of the @:
Company name only
Drop the extension:
Legacy domain
Any version:
Pitfalls & errors
#VALUE! if there’s no @. A blank or malformed entry has no @. Wrap in IFERROR for messy lists.
Subdomains. name@mail.acme.com returns mail.acme.com. For the root domain, more parsing is needed.
TEXTAFTER/TEXTBEFORE need Excel 365. Use the MID/FIND legacy version in older Excel.
Practice workbook
Frequently asked questions
How do I extract the domain from an email in Excel?
How do I get the username before the @?
How do I get just the company name without .com?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class