TEXTAFTER Function

Excel 365+

Summary

The TEXTAFTER function extracts text that appears after a specified delimiter within a text string. Perfect for parsing structured data like names, addresses, or file paths by pulling content that follows specific characters or words.

Syntax

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

Parameters

Parameter Type Required Description
text Text Yes Source text to parse
delimiter Text Yes Separator after which to extract
instance_num Number No Delimiter instance number (positive from start, negative from end)
match_mode Number No 0=case-sensitive, 1=case-insensitive
match_end Number No 0=normal match, 1=match end of text
if_not_found Any No Custom result when delimiter not found

Using the TEXTAFTER Function

TEXTAFTER shines in data cleaning tasks where you need to isolate portions of text after consistent separators. Use it to extract domain from emails, last names from full names, or path segments from file locations. Pairs perfectly with TEXTBEFORE for complete text splitting.

Common TEXTAFTER Examples

Extract Text After First Delimiter

=TEXTAFTER("Little Red Riding Hood's red hood", "Red")

Returns "Riding Hood's red hood" - everything after first "Red"

Second Occurrence Extraction

=TEXTAFTER("Little red Riding Hood's red hood", "red", 2)

Returns "hood" - text after second "red"

Search From End

=TEXTAFTER("Little red Riding Hood's red hood", "red", -2)

Returns "Riding Hood's red hood" - after second-to-last "red"

Case Insensitive Match

=TEXTAFTER("Little Red Riding Hood", "red",, 1)

Returns "Riding Hood" even though delimiter is lowercase

Extract Last Name Handling Edge Cases

=IF(TEXTAFTER(A2," ",,,1)="", A2, TEXTAFTER(A2," ",,,1))

Gets last name or full name if single word (Socrates example)

Frequently Asked Questions

Returns entire text (positive instance_num) or empty string (negative).

No, wildcards not supported in text or delimiter.

TEXTAFTER finds dynamic positions while RIGHT/MID need fixed character counts.

Common Errors and Solutions

#N/A - Delimiter Not Found

Cause: Delimiter doesn't exist in text

Solution: Verify spelling or use IFERROR wrapper

#VALUE! - Invalid instance_num

Cause: instance_num = 0 or exceeds text length

Solution: Use valid positive/negative numbers

#N/A - Instance Exceeds Occurrences

Cause: Requested instance_num larger than delimiter count

Solution: Check how many times delimiter appears

Notes

  • Opposite of TEXTBEFORE function
  • Empty delimiter behaves differently from front vs back
  • Excel 365+ only - check compatibility
  • Great for JSON/path parsing
  • Combines well with TEXTSPLIT

Compatibility

Available in: Excel 365, Excel 2021 (Current Channel), Monthly Enterprise, Semi-Annual Enterprise

Not available in: Excel 2019, Excel 2016, Excel for Mac (older versions), Excel Online (limited)

Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 365+