Extract the Domain from an Email

Excel Formulas › Text

All versionsMIDFINDTEXTAFTER

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.


Quick formula: for an email in A2:
=TEXTAFTER(A2, "@")
TEXTAFTER returns everything after the @ — the domain. The legacy version uses MID and FIND.

Functions used (tap for the full reference guide):

The example

Domains pulled from email addresses.

AB
1EmailDomain
2ana@acme.comacme.com
3ben@bolt.iobolt.io

The formula

The domain:

=TEXTAFTER(A2, "@") // "ana@acme.com" → "acme.com"

How it works

Split at the @ sign:

  1. TEXTAFTER(A2, "@") returns the text to the right of the @ — the full domain including the extension.
  2. In older Excel: =MID(A2, FIND("@", A2)+1, 100) — start one character after the @ and take the rest.
  3. For just the company part (drop .com): =TEXTBEFORE(TEXTAFTER(A2,"@"), ".").
  4. 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

Live demo

Type an email; see the domain and username.

Domain:   User:

Variations

Username (before @)

Everything left of the @:

=TEXTBEFORE(A2, "@")

Company name only

Drop the extension:

=TEXTBEFORE(TEXTAFTER(A2,"@"), ".")

Legacy domain

Any version:

=MID(A2, FIND("@",A2)+1, 100)

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

📊
Download the free Extract the Domain from an Email practice workbook
Emails with the live MID/FIND domain extraction, the TEXTAFTER, username, and company-only variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I extract the domain from an email in Excel?
Use =TEXTAFTER(A2, "@") in Excel 365, or =MID(A2, FIND("@",A2)+1, 100) in any version. Both return everything after the @ sign.
How do I get the username before the @?
Use =TEXTBEFORE(A2, "@") in 365, or =LEFT(A2, FIND("@",A2)-1) in older Excel.
How do I get just the company name without .com?
Nest the functions: =TEXTBEFORE(TEXTAFTER(A2,"@"), ".") returns the part between @ and the first dot.

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

Related formulas: Extract text between characters · Split text into columns · Count cells that contain text

Function references: TEXTAFTER · MID · FIND