How to extract the domain from an email address in Google Sheets
Google Sheets formula
=REGEXEXTRACT(A2,"@(.+)$")Capture everything after the @: =REGEXEXTRACT(A2,"@(.+)$").
- Result on the example
- one result per row in
B2, filled down toB6 - Excel
- See below
See it work
The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.
How it works
The pattern matches the @ and then (.+)$, everything up to the end of the text. Because the part after the @ is in parentheses, REGEXEXTRACT returns only that captured group, without the @.
=REGEXEXTRACT(A2,"@(.+)$")Result"northwind.example"
A2"ana.ruiz@northwind.example"The value in A2.
REGEXEXTRACT(A2,"@(.+)$")"northwind.example"REGEXEXTRACT: The first match, or the captured group(s). #N/A when nothing matches.- text
A2"ana.ruiz@northwind.example" - regular_expression
"@(.+)$"
- text
In Excel
=TEXTAFTER(A2,"@"). In older versions, =MID(A2,FIND("@",A2)+1,100).Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =TEXTAFTER(A2,"@")Excel only | northwind.example, contoso.example, mail.fabrikam.example… | The Excel version. |
| =REGEXEXTRACT(A2,"@([^.]+)") | northwind, contoso, mail…Different result | Capture up to the first dot to get a company-style name. northwind, contoso, mail (for the subdomain), litware, adatum. |
Common mistakes
- Cells with no @ return #N/A. Wrap the formula in IFNA to show a blank.
- Capitals come through as typed. Wrap in LOWER to group domains reliably:
=LOWER(REGEXEXTRACT(A2,"@(.+)$")).
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Extract the domain from an email address
B2, extract the domain (everything after the @) from the email in A2. Fill down to B6.Questions
How do I get the part before the @?
Capture from the start: =REGEXEXTRACT(A2,"^([^@]+)").
How do I count emails per domain?
Extract the domains in a column and use =QUERY(B1:B6,"select B, count(B) group by B",1).
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine.