Spreadsheet Practice

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

Excel formula

=TEXTAFTER(A2,"-",$E$1)

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

Result on the example
one result per row in B2, filled down to B6
Works in
Excel 2024 and Microsoft 365
Google Sheets
Different formula, see below

See it work

The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.

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.

=TEXTAFTER(A2,"-",$E$1)

Result"OLED-2026"

  1. A2"TV-55-OLED-2026"

    The value in A2.

  2. $E$12

    The value in E1.

  3. TEXTAFTER(A2,"-",$E$1)"OLED-2026"

    TEXTAFTER: Text after a delimiter.

    • textA2"TV-55-OLED-2026"
    • delimiter"-"
    • instance_num$E$12

In Google Sheets

Google Sheets needs a different formula: =MID(A2,FIND(CHAR(1),SUBSTITUTE(A2,"-",CHAR(1),$E$1))+1,LEN(A2)). On the same data it gives the same result. Here it is running in Google Sheets mode.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=MID(A2,FIND(CHAR(1),SUBSTITUTE(A2,"-",CHAR(1),$E$1))+1,LEN(A2))OLED-2026, PRO-512GB, USB…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.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Extract text after the nth occurrence of a character

In B2, extract everything after the dash whose number is in E1 (the 2nd dash) and fill down to B6.

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)).

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.