#### kgdsr

##### New Member
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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a \$25,000 loan, 5% annual interest, 60 month loan.

#### vds1

##### Well-known Member
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

#### ChrisBM

##### Board Regular
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)

#### VBA Geek

##### MrExcel MVP
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``````

Replies
0
Views
253
Replies
6
Views
501
Replies
2
Views
157
Replies
5
Views
582
Replies
6
Views
713

1,191,118
Messages
5,984,748
Members
439,907
Latest member
Kayfabe

### 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.

### Which adblocker are you using?

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

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