To get the domain from an email address in Excel, use a formula built on the position of the @ sign: =MID(A2,FIND("@",A2)+1,LEN(A2)). This returns everything after the @, such as example.com from name@example.com. It works in Excel for Microsoft 365, Excel 2021, 2019, 2016 and Excel for the web, and needs no add-ins or macros. The only thing you need first is a column of clean email addresses with exactly one @ symbol in each cell.
What You'll Need
- Excel for Microsoft 365, Excel 2021, 2019, 2016, Excel for the web, or Excel for Mac (the formulas below are the same on all of them).
- A column of email addresses, one per cell, with no leading or trailing spaces.
- A spare column to the right of your email column for the result.
Menu and ribbon labels can differ slightly by version, device and region, but the formulas here are identical everywhere.
Step-by-Step
- Put your emails in a single column. For this example, assume the first address is in cell A2, with a header in A1. Keep one address per cell; do not combine two addresses with a comma or semicolon.
- Click the first empty cell beside the data, for example B2, and type the formula:
=MID(A2,FIND("@",A2)+1,LEN(A2)) - Press Enter. B2 now shows only the part after the @, such as gmail.com or company.co.uk. The FIND function locates the @, adds 1 to start just after it, and MID returns the rest of the text.
- Copy the formula down. Select B2, grab the small square in the bottom-right corner of the cell (the fill handle) and drag down to the last row, or double-click the fill handle to fill to the end of the adjacent data. Alternatively, copy B2 and paste it into the cells below; relative references adjust automatically.
- Convert the results to plain text if you plan to delete column A. Select the formula column, press Ctrl+C (Cmd+C on Mac), then right-click and choose Paste Special > Values. This replaces the formulas with fixed text so the domains survive if the original emails are removed.
- Optional: make it case-consistent. Wrap the formula in LOWER to force lowercase, which helps when grouping or comparing domains:
=LOWER(MID(A2,FIND("@",A2)+1,LEN(A2))) - Optional: strip a trailing space. If pasted data sometimes carries a space after the address, wrap the whole thing in TRIM:
=TRIM(MID(A2,FIND("@",A2)+1,LEN(A2))) - Optional: count how many addresses share each domain. With domains in column B, use
=COUNTIF(B:B,B2)in C2 and fill down. This is useful for spotting which provider or company dominates a list.
Common Mistakes
- Using SEARCH instead of FIND with mixed case. Both work for @, but SEARCH is case-insensitive and accepts wildcards. For a literal @, FIND is the safer, more predictable choice.
- Forgetting the +1. Without it, the result starts with the @ itself (@example.com), which breaks matching and lookups later.
- Using a fixed length. Do not hard-code a number like 20 in MID; domains vary in length. LEN(A2) is deliberately generous and simply returns everything to the end of the text.
- Leaving stray spaces. A trailing space in the source cell produces a domain with a hidden space, so COUNTIF and VLOOKUP fail to match. TRIM first, or clean the source data.
- Cells with no @. FIND returns a #VALUE! error when the @ is missing. That is a data problem, not a formula problem; fix or remove the bad row.
- Cells with two @ symbols. The formula returns everything after the first @, including the second one. Real addresses have one @, so treat these as invalid input.
Tips
- If you use Excel for Microsoft 365 or Excel 2021 and later, TEXTBEFORE and TEXTAFTER are simpler:
=TEXTAFTER(A2,"@")returns the domain directly. If your version does not have it, Excel shows #NAME?; fall back to the MID/FIND formula. - To get the part before the @ (the local part) instead, use
=LEFT(A2,FIND("@",A2)-1). - To get just the top-level ending (com, org, uk), combine the domain formula with a second split on the last dot, or use
=TEXTAFTER(B2,".",-1)where available. - Apply the formula to a whole column at once with an Excel Table: select your data, press Ctrl+T, and enter the formula once in the new column; the table fills it down automatically as rows are added.
- Keep the original email column until you have verified the results; deleting it first makes debugging harder.
Troubleshooting
You see #VALUE!. The cell has no @ sign, or the cell is empty. Check the source row and correct or remove it.
You see #NAME?. You are using TEXTBEFORE or TEXTAFTER in a version of Excel that does not support it. Switch to the MID/FIND formula above.
The result looks right but lookups fail. Hidden spaces or inconsistent capitalisation are the usual cause. Wrap the formula in TRIM and LOWER, then recalculate.
The formula shows as text instead of calculating. The cell is probably formatted as Text, or the formula is missing its leading equals sign. Format the cell as General, then re-enter the formula.
Filling down gives wrong results. Check that references are relative (A2, not $A$2) unless you intentionally locked them. Press Ctrl+` (the key left of 1) to display formulas and inspect what each row actually references.
Nothing changed after editing the source. Calculation may be set to Manual. Go to the Formulas tab and set Calculation Options to Automatic, or press F9 to recalculate.
Frequently Asked Questions
Can I get the domain without a formula?
Yes. Use Data > Text to Columns, choose Delimited, set the delimiter to Other and type @, then finish. The part after the @ lands in the next column. This is a one-time split, not a live formula.
Does the formula work for subdomains like mail.example.com?
Yes. It returns everything after the @, so you get mail.example.com. If you want only the registered domain (example.com), you need an extra step to strip the subdomain, which is not reliable with a single simple formula.
Will it work in Google Sheets?
Yes. The same MID, FIND and LEN formula works in Google Sheets, and Sheets also supports TEXTAFTER in current versions.
How do I handle a list where some cells are blank?
Wrap the formula in IFERROR to hide errors: =IFERROR(MID(A2,FIND("@",A2)+1,LEN(A2)),""). Blank or invalid rows then show nothing instead of an error.
Can I extract the domain from a whole sentence containing an email?
The formula still finds the first @ and returns everything after it, which may include trailing words. Clean the text first, or use Text to Columns, so each cell holds only the address.
Is there a way to do this for many columns at once?
Yes. Copy the formula across columns as well as down; relative references shift with each column, so the same pattern applies to each email column you add.