# How to extract several parts of text into columns with REGEXEXTRACT in Google Sheets

Put each part you want in its own brackets: =REGEXEXTRACT(A2,"^([A-Z]+)-(\d{4})-(\d+)$") returns one column per bracket.

**Google Sheets:** `=REGEXEXTRACT(A2,"^([A-Z]+)-(\d{4})-(\d+)$")`

**Excel:** In Excel 365, REGEXEXTRACT returns the capture groups when its return mode is 2: =REGEXEXTRACT(A2,"^([A-Z]+)-(\d{4})-(\d+)$",2). When the parts are separated by one delimiter, =TEXTSPLIT(A2,"-") is simpler.

## Example

Sample data (row 1 is the header):

| A | B | C | D |
| --- | --- | --- | --- |
| Order code | Region | Year | Number |
| NW-2026-0142 |  |  |  |
| SE-2025-0087 |  |  |  |
| MIDWEST-2026-1120 |  |  |  |
| W-2026-0031 |  |  |  |
| INTL-2024-0009 |  |  |  |

Formula in B2, filled to B6: `=REGEXEXTRACT(A2,"^([A-Z]+)-(\d{4})-(\d+)$")`

Result: NW; SE; MIDWEST; W; INTL

## How it works

When a pattern has several capture groups (the parts in brackets), Google Sheets returns each group in its own column: the letters, the 4-digit year and the number. The ^ and $ make sure the whole code has this shape; a code that doesn't returns #N/A instead of a wrong split.

## Other ways

- `=SPLIT(A2,"-")`: When the parts are simply separated by a dash, SPLIT does the same. SPLIT turns "2026" into a number, while REGEXEXTRACT keeps text.

## Common mistakes

- Every bracket becomes a column. For grouping you don't want returned, use a non-capturing group `(?:…)`.
- The parts come back as text, including "2026" and "0142". Wrap a column in VALUE to calculate with it.

## Questions

**How do I return just one of the groups?**

Use a pattern with one capture group: `=REGEXEXTRACT(A2,"-(\d{4})-")` returns the year.

**How do I handle codes that don't match?**

Wrap the formula in `IFERROR(…,"")` and filter for blanks to review them.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/extract-parts-into-columns-with-regexextract
