REGEXEXTRACT function
Extraction — strings within the provided text that 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
Extract the contiguous digit sequence as text so leading zeros remain.
A worked example from the workbook
| Row | A |
|---|---|
| 6 | Input |
| 7 | INV-42 |
| 8 | INV-004 |
| 9 | PO-125 |
Record 1
=REGEXEXTRACT(A7,"[0-9]+")Expected result42
See the inputs and instructions for all 3 examplesCopyable formulas
English Excel · en-US
=REGEXEXTRACT("INV-042","[0-9]+")Turkish Excel · tr-TR
=NORMİFADEAYIKLA("INV-042";"[0-9]+")Expected result
“042”
Worked examples
Extract the contiguous digit sequence as text so leading zeros remain.
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-125 |
| Case | Formula | Expected result |
|---|---|---|
| Record 1 | =REGEXEXTRACT(A7,"[0-9]+") |
42 |
| Record 2 | =REGEXEXTRACT(A8,"[0-9]+") |
004 |
| Record 3 | =REGEXEXTRACT(A9,"[0-9]+") |
125 |