# How to find the position of the nth occurrence of a character in Excel

Mark the nth occurrence with SUBSTITUTE and find the mark: =FIND(CHAR(1),SUBSTITUTE(A2,"/",CHAR(1),$E$1)).

**Excel:** `=FIND(CHAR(1),SUBSTITUTE(A2,"/",CHAR(1),$E$1))` (Excel 2024 and Microsoft 365)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D | E |
| --- | --- | --- | --- | --- |
| Path | Position |  | Occurrence | 3 |
| /sales/2026/q1/report.pdf |  |  |  |  |
| /hr/policies/leave.docx |  |  |  |  |
| /finance/budget/2026/plan.xlsx |  |  |  |  |
| /marketing/brand/logo.png |  |  |  |  |
| /it/assets/laptops/list.csv |  |  |  |  |

Formula in B2, filled to B6: `=FIND(CHAR(1),SUBSTITUTE(A2,"/",CHAR(1),$E$1))`

Result: 12; 13; 16; 17; 11

## How it works

FIND only returns the first match, so the trick is to make the nth slash unique. SUBSTITUTE's fourth argument replaces only that occurrence, here with `CHAR(1)`, an invisible character that never appears in real text. FIND then returns its position, which is the position of the nth slash in the original.

## Other ways

- `=LEN(TEXTBEFORE(A2,"/",$E$1))+1`: Excel 365: the length of everything before the nth slash, plus one.

## Common mistakes

- Replacing with a visible character like "#" breaks as soon as the text contains one. CHAR(1) avoids that.
- If the text has fewer slashes than you ask for, SUBSTITUTE changes nothing and FIND returns #VALUE!. Wrap it in `IFERROR(…,0)`.

## Questions

**How do I find the position of the last occurrence?**

Count the slashes and use that as the instance: `=FIND(CHAR(1),SUBSTITUTE(A2,"/",CHAR(1),LEN(A2)-LEN(SUBSTITUTE(A2,"/",""))))`.

**How do I return the text after that position?**

Use MID: `=MID(A2,B2+1,LEN(A2))`, or TEXTAFTER with the instance number directly.

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/find-position-of-nth-occurrence
