Formulas - 2026-06-09

REGEXTEST in Excel: Pattern Matching Guide (With Examples)

Learn how to use the Excel REGEXTEST function to validate emails, IDs, and text patterns. Includes match_mode syntax, real examples, and fixes for #VALUE! errors.

What REGEXTEST Does in Excel

  • REGEXTEST is a dynamic array-era function that checks whether text matches a regular expression pattern. It returns TRUE or FALSE, which makes it ideal for data validation, cleaning imported files, and flagging rows that fail a format rule. Basic syntax: \\\ =REGEXTEST(text, pattern, [case_insensitive]) \\\ text — the cell or string to test pattern — a regex pattern in double quotes case_insensitive — optional; TRUE ignores upper/lower case (default FALSE) REGEXTEST is available in Microsoft 365 and Excel 2021 builds that include dynamic array functions. It will show #NAME? in Excel 2019 and older.

Example 1: Validate Email-Like Text

  • Flag rows where column A does not look like an email: \\\ =REGEXTEST(A2, "^[\\w.-]+@[\\w.-]+\\.[A-Za-z]{2,}$") \\\ Copy down to audit an export. FALSE rows need manual review before a mail merge. For a friendly label: \\\ =IF(REGEXTEST(A2, "^[\\w.-]+@[\\w.-]+\\.[A-Za-z]{2,}$"), "OK", "Check email") \\\

Example 2: Product SKU Format

  • Require SKUs like \ABC-1234\ (three letters, hyphen, four digits): \\\ =REGEXTEST(B2, "^[A-Z]{3}-\\d{4}$") \\\ Use with conditional formatting to highlight invalid SKUs before VLOOKUP or XLOOKUP runs on the column.

Example 3: Contains a Word (Partial Match)

  • Check whether a cell contains "North" as a whole word: \\\ =REGEXTEST(C2, "\\bNorth\\b") \\\ This is often cleaner than nested FIND and SEARCH when you need word boundaries.

Example 4: Audit Phone Numbers (US-Style)

  • Simple 10-digit pattern (adjust for your locale): \\\ =REGEXTEST(D2, "^\\d{3}-\\d{3}-\\d{4}$") \\\ Pair with TRIM first if imports include spaces: \\\ =REGEXTEST(TRIM(D2), "^\\d{3}-\\d{3}-\\d{4}$") \\\

REGEXTEST vs FIND, SEARCH, and Data Validation

  • Approach Best for REGEXTEST Flexible patterns (emails, IDs, codes) FIND / SEARCH Simple substring checks Data Validation Blocking bad input at entry time Use REGEXTEST in helper columns during audits; use Data Validation to prevent bad data upstream.

Common Errors

  • #VALUE! — Invalid regex syntax. Escape backslashes in Excel strings (use \\\\\d\ not \\\d\ in some patterns). #NAME? — Function not available in your Excel version. Always TRUE/FALSE — Pattern too broad or text already normalized; test on three known rows first.

Related Resources

  • FILTER function — return rows that pass a logic test IF function — label rows based on REGEXTEST TRIM function — clean text before pattern tests Fix #VALUE! errors Excel text functions guide

Formula debugging workflow

  • Step Action 1 Select the cell and read the formula in the formula bar 2 Use Formulas → Evaluate Formula for nested functions 3 Check for text stored as numbers (green triangle) 4 Fix errors using our formula error guide Go deeper: Compare similar functions · Fix common problems

Frequently asked questions

  • Is REGEXTEST available in Excel 2019? No on desktop Excel 2019. REGEXTEST requires Excel 2021 or Microsoft 365 with a build that includes the function.
  • What is the difference between REGEXTEST and regular FIND? FIND searches for a fixed substring. REGEXTEST matches flexible patterns such as email formats, IDs with hyphens, or digit counts using regular expression syntax.
  • Why does REGEXTEST return #VALUE!? Usually an invalid regex pattern or an argument that is not text. Escape special characters correctly and wrap patterns in double quotes.
  • Why does my formula show an error? Open the linked error pages (#N/A, #VALUE!, #REF!) from our directory. Most formula posts fail because of data type mismatches, deleted references, or wrong match modes — not because the function name is wrong.
  • Should I copy formulas down or use a Table? Copying down is fine for one-off models. Convert the range to an Excel Table when you add rows often — structured references stay readable and break less.