How to sort email address by domain in Excel?
When working with email lists in Excel, you may need to organize or analyze data by the domain portion of email addresses, such as grouping users from the same company or filtering out certain providers. Sorting email addresses by their domain can be valuable for segmenting data, targeting communications, or preparing for further analysis. Excel does not offer a direct way to sort by domain, but with the following practical approaches, you can accomplish this efficiently. These methods are suitable whether you're dealing with a small contact list or large database, and each comes with its own convenience and considerations.
Sort email address by domain with Text to Column function
Sort email address by domain with a help column
Sort email address by Kutools for Excel
Sort email address by domain using Excel VBA
Sort email address by domain with Text to Column function
Excel’s Text to Column feature allows you to split the domain part from each email address so you can sort by that column. This method is straightforward and does not require formulas or add-ins, making it ideal for users who want a quick, built-in solution. However, you should keep in mind that splitting columns will affect your original data, so creating a backup worksheet is recommended for safety.
1. Before applying the split, you may want to copy your email data to a new worksheet to avoid overwriting your original data, especially if you want to keep the addresses in their initial format.
2. In your backup worksheet, select the column containing the email addresses. Next, go to the Data tab and click Text to Columns. This will start the wizard to separate text based on chosen delimiters.

3. In the Convert Text to Column Wizard, select the Delimited option, which allows you to split text based on a specific character, then click Next to continue.

4. For the delimiters, clear all selections except Other. In the Other field, enter the "@" symbol, since it separates the local part from the domain in email addresses. This ensures that Excel will split the address into two columns — one with the username and one with the domain. Take care not to select additional delimiters or it may split your data unexpectedly.

5. Continue by clicking Next and then Finish. Your worksheet will now show the domains in a separate column next to the original email addresses. This result makes it visible and easier to use for sorting purposes.

6. Copy the newly separated domain values and paste them next to your original data, if necessary. Then select the column containing the domains. Proceed to Data > Sort A to Z or Sort Z to A depending on whether you want ascending or descending order. This will organize the entire row of data based on the domain name.

7. When prompted with a Sort Warning dialog, make sure you select Expand the selection. This option ensures that all relevant rows move together, preventing misalignment between names and email addresses. Click Sort to execute the arrangement.
![]() |
![]() |
![]() |
8. After sorting is complete, you can delete the column containing the domains if you no longer need it. Before deleting, double-check that your data is correctly aligned and sorted.
Tips: If your email addresses contain spaces or additional characters, ensure the format is consistent before applying Text to Columns. Otherwise, you may need to clean up the data first to avoid improper splitting.
Sort email address by domain with a help column
If you find the split method inconvenient or prefer using Excel formulas, adding a helper column provides an efficient alternative. This method is especially beneficial when you want to preserve your original data structure and prefer to keep the email address whole alongside the extracted domain.
1. In your worksheet, insert a blank column next to your list of email addresses. In the first cell of this column (e.g., C2 if your emails start in B2), enter the formula below to extract the domain name from the email address. For example, if cell B2 contains the email address you want to process:
=MID(B2,FIND("@",B2,1)+1,255) This formula uses MID and FIND to search for the "@" symbol and return all characters after it, effectively capturing the domain part.

2. Press Enter to confirm the formula. Then, using the fill handle (the small square at the bottom right corner of the cell), drag the formula down to populate the helper column for all email addresses in your list. This will extract the domain from each corresponding email address. Double-check results for any outliers or formatting issues, as non-standard emails may yield errors or incomplete domains.

3. Select the helper column with the extracted domains. Go to Data > Sort A to Z or Sort Z to A according to your sorting preference. In the Sort Warning dialog, choose Expand the selection to keep all associated data aligned.
![]() |
![]() |
![]() |
4. You can remove the helper column once the sort is complete if you no longer need it, but it's recommended to double-check that all email addresses and their corresponding rows remain correctly aligned after sorting. If you plan to repeatedly sort or filter by domain, it’s practical to keep the helper column for future use.
Troubleshooting tip: If you see #VALUE! errors, check for emails missing the “@” symbol or extra spaces. Clean up these entries to ensure accurate domain extraction.
Sort email address by Kutools for Excel
For users who have Kutools for Excel installed, the Advanced Sort functionality offers a convenient way to sort data by email domain directly, saving time compared to manual splitting or formula writing. Kutools excels when managing large or complex datasets, supporting multi-level sorting and helping you avoid column misalignment.
Kutools for Excel includes more than300 handy Excel tools. Free to try with no limitation in30 days. Get it Now
1. Highlight your range containing names and emails. Next, select Kutools Plus > Advanced Sort. This feature can sort by almost any part of the data, including a custom field like domain names.
2. In the Advanced Sort dialog, confirm if your range contains headers by checking My data has headers. For the Sort On drop-down, select the column you want to sort by, and choose Mail domain as the key. You can then choose your sorting order (A to Z or Z to A). If your worksheet includes other fields, you may add more sorting levels for complex needs.

3. Click Ok and Kutools will immediately sort your data by domain, keeping all your rows intact and original information in place. Review the sorted sheet to verify the arrangement.

Click here for more information on Kutools for Excel's Advanced Sort.
Note: Kutools makes advanced sorting easier and reliably maintains data structure even if your list contains extra fields.
Sort email address by domain using Excel VBA
This solution is particularly useful if you manage email lists regularly and prefer to automate the sorting process. Using VBA, you can extract domains and sort automatically with a single command. VBA works well with large datasets and minimizes manual intervention, but requires enabling macros and basic familiarity with the VBA editor.
1. In Excel, click Developer > Visual Basic to open the VBA editor window. Then, click Insert > Module and copy the following code into the module:
Sub SortEmailDomain()
Dim ws As Worksheet
Dim emailCol As Range
Dim domainCol As Range
Dim cell As Range
Dim lastRow As Long
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set ws = Application.ActiveSheet
lastRow = ws.Cells(ws.Rows.Count, 2).End(xlUp).Row
Set emailCol = ws.Range("B2:B" & lastRow)
Set domainCol = ws.Range("C2:C" & lastRow)
For Each cell In emailCol
cell.Offset(0, 1).Value = Mid(cell.Value, InStr(cell.Value, "@") + 1)
Next cell
ws.Range("B1:C" & lastRow).Sort Key1:=ws.Range("C2"), Order1:=xlAscending, Header:=xlYes
End Sub 2. After inserting the code, click the
Run button to execute. This macro extracts the domain of each email (assumed to be in column B, starting from B2) into column C and sorts your list by domains. Make sure emails start from B2 and adjust if your list starts elsewhere.
Tips: If your emails are not in column B or start from a different cell, modify the code accordingly for accuracy. Always back up your data before running macros to prevent unintentional changes.
Compare these methods based on your requirements. If you need a quick, manual solution, Text to Column or a formula helper column may be sufficient, but they require some post-processing. Kutools for Excel offers a smoother user experience, especially for complex lists. The VBA approach suits those who want to automate tasks regularly. In all cases, ensure that the entire list is updated and checked for errors before further processing.
Related articles:
How to sort data by the most frequent value in Excel?
How to sort rows to put the blank cells on top in Excel?
How to sort or filter data by strikethrough in Excel?
How to sort rows by odd or even numbers in Excel?
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
All Kutools add-ins. One installer
Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.
- All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
- One installer, one license — set up in minutes (MSI-ready)
- Works better together — streamlined productivity across Office apps
- 30-day full-featured trial — no registration, no credit card
- Best value — save vs buying individual add-in



