How to get the domain from an email address with TEXTAFTER

The part of an email address after the @ sign, pulled out on its own. Useful for grouping a contact list by company or provider.

The formula

=TEXTAFTER(A2,"@") in column B

What each part does

A2
The email address to read.
"@"
The sign to split at. TEXTAFTER returns everything that comes after it.

How it works, and what to watch for

TEXTAFTER splits the text at the sign you name and returns everything after it. Giving it "@" returns the domain, and nothing else needs to be worked out by hand.

An address always has exactly one @ sign, so there is no ambiguity about where to split. If a cell somehow has none, TEXTAFTER returns #N/A, which is a quick way to flag a bad address.

TEXTAFTER needs Microsoft 365. On an earlier version, MID(A2,FIND("@",A2)+1,100) does the same job: it starts one character past the @ and takes everything to the end.

Questions

How do I get the name instead of the domain?

Use TEXTBEFORE(A2,"@"), which returns everything before the sign.

How do I drop the .com as well?

Wrap it: TEXTBEFORE(TEXTAFTER(A2,"@"),"."), which takes the domain and then the part before the first dot.

What if a cell is not an email?

With no @ sign TEXTAFTER returns #N/A. Wrap it in IFERROR to leave the cell blank, or to show a note of your own.

The example sheet

Email Domain
[email protected]
[email protected]
[email protected]

If this helped, these are close by

More on TEXTAFTER, and every walkthrough that uses it.

Settings: separator, Excel version

Argument separator

Set by your computer's language, not by the file. A frequent cause of a correct-looking formula being rejected.

Excel version

XLOOKUP, IFS, TEXTBEFORE and TEXTJOIN need Microsoft 365 or 2021; older versions return #NAME? instead. Choosing the older one switches every walkthrough to a formula that works there.