# How to extract the domain from an email address in Google Sheets

Capture everything after the @: `=REGEXEXTRACT(A2,"@(.+)$")`.

**Google Sheets:** `=REGEXEXTRACT(A2,"@(.+)$")`

**Excel:** In Excel 2024 or Microsoft 365, use `=TEXTAFTER(A2,"@")`. In older versions, `=MID(A2,FIND("@",A2)+1,100)`.

## Example

Sample data (row 1 is the header):

| A | B |
| --- | --- |
| Email | Domain |
| ana.ruiz@northwind.example |  |
| raj@contoso.example |  |
| lee.chen@mail.fabrikam.example |  |
| kim@litware.example |  |
| mo.diaz@adatum.example |  |

Formula in B2, filled to B6: `=REGEXEXTRACT(A2,"@(.+)$")`

Result: northwind.example; contoso.example; mail.fabrikam.example; litware.example; adatum.example

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

## Other ways

- `=TEXTAFTER(A2,"@")`: The Excel version.
- `=REGEXEXTRACT(A2,"@([^.]+)")`: 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,"@(.+)$"))`.

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

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/extract-the-domain-from-an-email
