Spreadsheet Practice

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 to B6
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"

  1. A2"ana.ruiz@northwind.example"

    The value in A2.

  2. REGEXEXTRACT(A2,"@(.+)$")"northwind.example"

    REGEXEXTRACT: The first match, or the captured group(s). #N/A when nothing matches.

    • textA2"ana.ruiz@northwind.example"
    • regular_expression"@(.+)$"

In Excel

In Excel 2024 or Microsoft 365, use =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.

FormulaResultWhen to use it
=TEXTAFTER(A2,"@")Excel onlynorthwind.example, contoso.example, mail.fabrikam.example…The Excel version.
=REGEXEXTRACT(A2,"@([^.]+)")northwind, contoso, mail…Different resultCapture 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

In 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.