How to Extract Domain from Email in Excel
In this article
To extract the domain from an email address in Excel, use the formula =MID(A1,FIND("@",A1)+1,LEN(A1)) assuming the email is in cell A1. This returns everything after the @ symbol, which is the domain. For a column of emails, enter the formula in the first row and fill down. That single formula works in Excel for Microsoft 365, Excel 2019, 2021, and Excel for the web, and it handles any valid email address without add-ins or macros.
What You'll Need
- Excel 2016 or later (including Microsoft 365 and Excel for the web). The formulas below use FIND, MID, LEN, and IFERROR, which are available in all these versions.
- A column of email addresses, one per cell, with no leading or trailing spaces. If your data has spaces, trim them first (see Step 1).
- Optional: a helper column for the domain, so you keep the original email intact.
Step-by-Step
- Clean the data. Select your email column. On the Home tab, click Find & Select > Replace (or press Ctrl+H). In Find what, type a single space; leave Replace with blank; click Replace All. This removes stray spaces that would break the formula. Do the same for non-breaking spaces if you pasted from a web page: use =TRIM(SUBSTITUTE(A1,CHAR(160)," ")) in a helper column, then copy and paste values back.
- Choose a destination column. Click the header of the column to the right of your emails (for example, column B if emails are in column A). Type a header such as Domain in B1.
- Enter the domain formula. In B2, type =MID(A2,FIND("@",A2)+1,LEN(A2)) and press Enter. This finds the @ position, adds 1, and returns all characters from there to the end. For user@example.com, it returns example.com.
- Fill down. Click B2, then double-click the small square at the bottom-right corner of the cell (the fill handle). Excel fills the formula down to the last row of adjacent data. Alternatively, drag the fill handle down manually.
- Handle errors. If a cell has no @ or is blank, the formula returns #VALUE!. Wrap it: =IFERROR(MID(A2,FIND("@",A2)+1,LEN(A2)),""). This leaves the cell blank instead of showing an error. Enter this version in B2 and fill down.
- Convert to values (optional). If you want to delete the original email column, first select the domain column, press Ctrl+C, then right-click and choose Paste Special > Values. This replaces formulas with plain text so the domains stay put when the source column is removed.
- Remove subdomains (optional). If you need only the root domain (example.com from mail.example.com), use a more advanced formula: =IFERROR(RIGHT(B2,LEN(B2)-FIND("@",SUBSTITUTE(B2,".","@",LEN(B2)-LEN(SUBSTITUTE(B2,".",""))))) ,"") — but this is fragile. A safer approach is to split by dots using Text to Columns (Data > Text to Columns > Delimited > Other: .) and keep the last two segments, or use Power Query: Data > From Table/Range, then split the domain column by delimiter and keep the last two parts. Note that country-code domains like example.co.uk need three parts; adjust manually.
Common Mistakes
- Forgetting to clean spaces. A trailing space after the domain makes the result look correct but causes mismatches in lookups. Always trim first.
- Using a fixed number in MID. Some guides suggest =MID(A2,8,50) assuming a fixed position for @. That fails when the local part length varies. Always use FIND to locate @ dynamically.
- Not wrapping with IFERROR. Blank cells or malformed emails produce #VALUE! errors that clutter the sheet and break downstream formulas.
- Deleting the email column before pasting values. If you delete the source column while the domain column still contains formulas, every cell shows #REF!. Convert to values first.
- Assuming every email has exactly one @. Valid emails have one @, but pasted data can contain extra characters. The FIND formula uses the first @, which is correct for standard addresses; if you see odd results, check the source cell for typos.
Tips
- Use a helper column rather than overwriting the original emails. You can always delete it later.
- For large datasets (thousands of rows), Power Query is faster and more reliable than fill-down formulas. Load your table via Data > From Table/Range, add a custom column with the same MID/FIND logic, and close & load.
- To extract the username (before @), use =LEFT(A2,FIND("@",A2)-1).
- If you need to count unique domains, after extracting them, use =SUMPRODUCT(1/COUNTIF(B2:B100,B2:B100)) or a PivotTable.
- Keyboard shortcut for fill down: select B2:B100, press Ctrl+D.
Troubleshooting
- Formula returns #VALUE!: The cell has no @ or is blank. Use the IFERROR wrapper. Also check for hidden characters with =LEN(A2) and compare to visible length.
- Result includes extra text: The email may contain a space before the domain (e.g., "user@ example.com"). Clean with TRIM and SUBSTITUTE as in Step 1.
- Fill handle does not work: The adjacent column may have blank rows. Select the range manually and press Ctrl+D.
- Formula shows as text: The cell is formatted as Text. Change format to General (Home > Number Format > General), then re-enter the formula.
- Domains look correct but lookups fail: There may be trailing spaces. Use =TRIM(B2) in a new column and paste values back.
- Need to handle multiple @ signs: Excel's FIND returns the first @. If your data legitimately contains more than one (rare), use =MID(A2,FIND("@",A2)+1,LEN(A2)) still works for standard emails; otherwise, clean the source.
Frequently Asked Questions
Can I extract the domain without a formula?
Yes. Use Data > Text to Columns with @ as the delimiter. The second column will contain the domain. This is quick for one-off tasks but not dynamic; if emails change, you must repeat the step.
Does this work in Excel for Mac?
Yes. The formulas and menu paths are the same, though the ribbon layout may differ slightly. Use Command+Shift+Down to select to the bottom of the column if the fill handle is awkward.
How do I extract the domain from an email in Google Sheets?
The same formula works: =MID(A2,FIND("@",A2)+1,LEN(A2)). Google Sheets also supports REGEXEXTRACT: =REGEXEXTRACT(A2,"@(.+)").
What if the email has no @ symbol?
The formula returns #VALUE!. Wrap with IFERROR to show a blank or a custom message like "Invalid email".
Can I get just the top-level domain (like .com)?
Yes, but it requires more logic. Use =RIGHT(B2,LEN(B2)-FIND("@",SUBSTITUTE(B2,".","@",LEN(B2)-LEN(SUBSTITUTE(B2,".",""))))) to get the last segment after the final dot. For most business uses, the full domain after @ is what you need.
Is there a built-in Excel function for this?
No. Excel has no dedicated email-parsing function. The MID/FIND combination is the standard approach. Power Query offers a more robust alternative for repeated imports.