James
James

Reputation: 59

Excel - How to sort column of email addresses by domain name?

MS Excel

I have a column of email addresses.

I need to sort the column of emails a-z based on everything after the @. (on domain)

I have tried data / text to columns / delimiter @ but, I can only get the domain list that is split off to sort.

I also tried dragging this down in a new column:

=MID(A1, FIND("@",A1, 1)+1, 255)

The problem is, I just get a list of domains I can sort independent of the actual addresses.

I know I must be doing something wrong obviously.

What I have:

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

What I want: (results can be in another column, or not, I don't care.)

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

How do I get the darn sorted results with the entire email address into another column OR just sort in the same column based on everything after the @????? (Preserving the whole email address, now sorted)

Thanks in advance for the learning experience.

Upvotes: 2

Views: 11243

Answers (3)

smonff
smonff

Reputation: 3497

  • Copy the content of your A email addresses in a blank B column
  • Select the B column and type Ctrl + h (search and replace)
  • In the Search field, type *@ to capture everything before the @ plus the @
  • Leave the Replace field blank and hit the Replace all button
  • Sort the B column, you're done.

search replace in excel before sorting

Upvotes: 0

Bruce Wilson
Bruce Wilson

Reputation: 1

If you have Excel 2013 the new "flash fill" feature can do this also. Create a new column; start entering domains; after a bit you will see the rest of the domains magically appear below (at least they did for me).

Upvotes: 0

Jilji
Jilji

Reputation: 254

copy your email address in column A and domain in column B (using =MID(A1, FIND("@",A1, 1)+1, 255)) , then select both column A and B then sort by B Ascending.

Upvotes: 2

Related Questions