Sorting Email address list

kgdsr

New Member
Joined
Sep 22, 2014
Messages
1
hello, If you have a huge list of email addresses is there any other way to sort them, then by the first letter of the cell? My goal is to be able to sort by "@aol.com" or "@gmail.com", ETC... Is this possible?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Have an helper column using formula below, suppose you have email address in column A, then in b2 try

=RIGHT(A1,LEN(A1)-FIND("@",A1))

this formula will return the domain. Eg : gmail . com

Next, you can first sort by column B and then by column A adding levels
 
Upvote 0
If you have an email address in Cell G11 for example:

To return the "@gmail.com" or "@aol.com" but use = MID(G11, FIND("@", G11,1), LEN(G11) - FIND("@", G11,1)+1)
 
Upvote 0
List your emails down column A and run

Code:
Sub SortByMailDomain()
Application.ScreenUpdating = False
With Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
    .TextToColumns , xlDelimited, xlTextQualifierNone, False, False, False, False, False, True, "@"
    .Resize(, 2).Sort Range("B1"), xlAscending, , , , , , xlNo
    .Value = Evaluate(Replace("A1:A#&""@""&B1:B#", "#", Range("A" & Rows.Count).End(xlUp).Row))
    .Offset(, 1).Clear
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,194
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top