Skip to content
Excel functionNot in Google Sheets

TEXTAFTER function in Google Sheets

Google Sheets doesn't have TEXTAFTER — here's what does.

Google Sheets gets there with REGEXEXTRACT: a lazy pattern for the first occurrence, a greedy one for the last.

What TEXTAFTER does in Excel

Returns text that occurs after given character or string

=TEXTAFTER(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])

Convert TEXTAFTER formulas to Google Sheets

Before and after, formula by formula.

  1. The domain after the @:

    Excel
    =TEXTAFTER(A2, "@")
    Google Sheets
    =REGEXEXTRACT(A2, "@(.*)")

    The match starts at the first @ and (.*) takes the rest. INDEX(SPLIT(A2, "@"), 2) only matches when the delimiter appears once.

  2. Everything after the LAST slash:

    Excel
    =TEXTAFTER(A2, "/", -1)
    Google Sheets
    =REGEXEXTRACT(A2, ".*/(.*)")

    The greedy .* swallows every earlier slash, so the capture starts after the final one.

  3. After the second dash, with a fallback when there is none:

    Excel
    =TEXTAFTER(A2, "-", 2, , , "n/a")
    Google Sheets
    =IFNA(REGEXEXTRACT(A2, "^(?:.*?-){2}(.*)"), "n/a")

Worth knowing

  • Escape regex metacharacters in the delimiter: a dot is \., a pipe \|, a bracket \(. The Migration Assistant does this for you.
  • For a case-insensitive match (match_mode 1), start the pattern with (?i).

Converting more than one formula? Formula Foundry's Migration Assistant scans every sheet in a workbook, fixes the formulas the Excel ↔ Sheets translator can convert, and flags every TEXTAFTER it can't so none slip through silently.