# How to extract text after the nth occurrence of a character in Excel

Give TEXTAFTER the instance number: =TEXTAFTER(A2,"-",2) returns everything after the second dash.

**Excel:** `=TEXTAFTER(A2,"-",$E$1)` (Excel 2024 and Microsoft 365)

**Google Sheets:** `=MID(A2,FIND(CHAR(1),SUBSTITUTE(A2,"-",CHAR(1),$E$1))+1,LEN(A2))`

## Example

Sample data (row 1 is the header):

| A | B | C | D | E |
| --- | --- | --- | --- | --- |
| SKU | After the nth dash |  | Occurrence | 2 |
| TV-55-OLED-2026 |  |  |  |  |
| LP-14-PRO-512GB |  |  |  |  |
| HD-2TB-USB |  |  |  |  |
| MON-27-4K-IPS-2025 |  |  |  |  |
| KB-WL-US |  |  |  |  |

Formula in B2, filled to B6: `=TEXTAFTER(A2,"-",$E$1)`

Result: OLED-2026; PRO-512GB; USB; 4K-IPS-2025; US

## How it works

The third argument of TEXTAFTER picks which occurrence to split at. With 2, the first dash is skipped and the text after the second one comes back.

The classic version uses SUBSTITUTE's instance argument to replace only the nth dash with `CHAR(1)`, a character that never appears in normal text, finds it, and takes everything after it with MID.

## Other ways

- `=MID(A2,FIND(CHAR(1),SUBSTITUTE(A2,"-",CHAR(1),$E$1))+1,LEN(A2))`: Works in every version and in Google Sheets.

## Common mistakes

- Asking for an occurrence that isn't there, like the 3rd dash in "KB-WL-US", returns #N/A. Add a fallback in the sixth argument: `TEXTAFTER(A2,"-",$E$1,,,"")`.
- A negative instance counts from the end: `TEXTAFTER(A2,"-",-2)` returns the last two parts.

## Questions

**How do I get the text before the nth occurrence?**

Use TEXTBEFORE with the same instance: `=TEXTBEFORE(A2,"-",2)` returns "TV-55".

**How do I get just the part between the 2nd and 3rd dash?**

Nest them: `=TEXTBEFORE(TEXTAFTER(A2,"-",2),"-",,,,TEXTAFTER(A2,"-",2))`.

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-text-after-nth-occurrence
