REGEXTEST function
Determination — whether any part of text matches the pattern.
Text · Microsoft 365
Where can you use it?
Data preparation and reporting teams. Use this group to clean, split or reformat IDs, names and descriptions before using them in reports.
Scenario in the workbook
Validate the entire invoice ID. The anchors prevent partial matches.
A worked example from the workbook
| Row | A |
|---|---|
| 6 | Input |
| 7 | INV-42 |
| 8 | INV-004 |
| 9 | PO-42 |
Record 1
=REGEXTEST(A7,"^INV-[0-9]+$")Expected resultTRUE
See the inputs and instructions for all 3 examplesCopyable formulas
English Excel · en-US
=REGEXTEST("INV-042","^INV-")Turkish Excel · tr-TR
=NORMİFADESINA("INV-042";"^INV-")Expected result
TRUE
Worked examples
Validate the entire invoice ID. The anchors prevent partial matches.
Open the English sheet. Inputs begin at A6. F7:F9 show the live results and G7:G9 show the original results for comparison.
| Row | A |
|---|---|
| 6 | Input |
| 7 | INV-42 |
| 8 | INV-004 |
| 9 | PO-42 |
| Case | Formula | Expected result |
|---|---|---|
| Record 1 | =REGEXTEST(A7,"^INV-[0-9]+$") |
TRUE |
| Record 2 | =REGEXTEST(A8,"^INV-[0-9]+$") |
TRUE |
| Record 3 | =REGEXTEST(A9,"^INV-[0-9]+$") |
FALSE |