REGEXTEST Function in Excel: Does Text Match a Pattern?

REGEXTEST Function in Excel: Does Text Match a Pattern? featured illustration

πŸ“Ž This article includes 1 downloadable practice file ↓

⏱ 2 min readUpdated 5 October 2026

TextLevel: ExpertAvailable in: Excel 365 / 2021+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. REGEXTEST in practice
  5. Where you will use it
  6. Worked example
  7. Mistakes people make
  8. Related functions
  9. Continue learning

REGEXTEST returns TRUE if text matches a regular expression β€” validate PAN numbers, emails or codes in one formula.

Advertisement

Syntax

=REGEXTEST(text, pattern, [case_sensitivity])
Argument What it means
pattern A regular expression.

Examples

Example 1

=REGEXTEST(A2, "^[A-Z]{5}[0-9]{4}[A-Z]$")

Checks the PAN format (5 letters, 4 digits, 1 letter).

REGEXTEST in practice

Where you will use it

  • Validate email or PIN code format
  • Check GSTIN structure
  • Flag bad data

Worked example

TextFormulaResult
411001=REGEXTEST(A2,"^\d{6}$")TRUE
4110=REGEXTEST(A3,"^\d{6}$")FALSE
[email protected]=REGEXTEST(A4,"^[^@ ]+@[^@ ]+\.[a-z]+$")TRUE

Worked out step by step, not calculated here: REGEXTEST needs the latest Microsoft 365.

Mistakes people make

MistakeWhat to do instead
AnchorsUse ^ and $ to test the whole text
Over-strict emailsKeep email patterns simple

REGEXEXTRACT Β· REGEXREPLACE

πŸ“š Part of the free Excel course: Beginner β†’ Expert Β· Try it in the Formula Lab or ask the AI Helper.

⚑ Interactive Practice Lab & Formula Tester:

Test formulas dynamically in our web formula laboratory or download the companion Excel workbook.

πŸ“Ž Practice files for this article

  • πŸ“—
    Practice workbook: Text & cleaning24 tasks on realistic sales data β€” type your formula, the Check column turns green when it is right. Answers sheet included.
    ⬇ XLSX Β· 35 KB

Free to use for learning. Files with macros (.bas) are plain text β€” import them with Alt+F11 β†’ File β†’ Import File, and always test on a copy.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free Β· AI can be wrong