We help IT Professionals succeed at work.

Sort Excel by domain name after @ symbol

Hello

We have a Excel spreadsheet with thousands of email addresses because we are in business 15 years.

If our spreadsheet is like the following:

amy@hotmail.com
andrew@example.com
craig@gmail.com
joe@example.com
pat@company.com
steve@gmail.com
tara@yahoo.com

Can we sort it by domain names or after the @ symbol like this?

pat@company.com
andrew@example.com
joe@example.com
craig@gmail.com
steve@gmail.com
amy@hotmail.com
tara@yahoo.com

Thank you
Daniel
Comment
Watch Question

Glenn RayExcel VBA Developer
Top Expert 2014

Commented:
You could add a new column to your data that contains only the domain name and then sort on that.  For example:

If the existing data is in column A, starting on row 1, then in cell B1 enter
=MID(A1,FIND("@",A1)+1,50)
Copy this formula down column B.

Sort the list by the values in column B

-Glenn
Excel VBA Developer
Top Expert 2014
Commented:
Better yet...add an additional column for the username (with a new formula) and then sort by domain then username.

See the attached example.

-Glenn EE-DomainSort.xlsx
Glenn,

The UserName column is unnecessary - simply sorting on Domain first and then Email gives identical results.

Regards,
Brian.
Glenn RayExcel VBA Developer
Top Expert 2014

Commented:
You're correct.  But I also wanted to show the LEFT substring function.