Text & Regex FormulaGoogle Sheets V8 Engine Verified

Google Sheets REGEXEXTRACT: Extract Numbers, Emails & Text via Regex

REGEXEXTRACT extracts matching substrings from a text string according to Google RE2 regular expression patterns. Ideal for isolating email addresses, SKU codes, domain names, and phone numbers from unstructured notes.

Formula Syntax:=REGEXEXTRACT(text, regular_expression)

Formula Parameters & Arguments

ArgumentTypeRequiredDescription
textTextRequiredThe source string or cell coordinate.
regular_expressionText (Regex)RequiredThe regular expression pattern enclosed in quotes.

Real-World Spreadsheet Examples

Explore verified operational formulas used in enterprise reporting and database workflows:

Example 1: Extract Email Address from Support Note

=REGEXEXTRACT(A2, "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}")
How it works: Pulls the email address from strings like "Contact customer at [email protected] immediately".

Example 2: Extract Root Domain from Full URL

=REGEXEXTRACT(A2, "^(?:https?:\/\/)?(?:www\.)?([^\/\?#]+)")
How it works: Converts "https://www.googlesolution.com/tools/json" to "googlesolution.com".

Example 3: Extract Digits Only (Invoice Number)

=REGEXEXTRACT(A2, "\d+")
How it works: Pulls 984201 from "Invoice_INV-984201_Final".

Common Errors & Solutions

❌ #N/A Function REGEXEXTRACT parameter 2 did not match
Resolution: The pattern did not match text. Wrap in IFERROR: =IFERROR(REGEXEXTRACT(A2, "\d+"), "None").

Performance Pro Tips

  • Use capture groups `()` to extract specific parts of a pattern without including surrounding prefix characters.
  • Combine with ARRAYFORMULA to clean thousands of rows simultaneously: `=ARRAYFORMULA(IF(A2:A="", "", IFERROR(REGEXEXTRACT(A2:A, "\d+"))))`.

Frequently Asked Questions

Does REGEXEXTRACT recalculate automatically when data changes?

Yes. Google Sheets recalculates all dependent formulas immediately whenever referenced input cells are modified.

Is this formula compatible with Microsoft Excel?

Modern functions like XLOOKUP, FILTER, UNIQUE, SORT, and LET are natively supported in Excel 365. However, QUERY is unique to Google Sheets and uses the Google Visualization API syntax.

Related Google Sheets Formulas