formulastreak

Text function

TEXTAFTER function in Excel

TEXTAFTER returns the part of a text that comes after a delimiter, such as everything after the first space.

Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet

Syntax

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

Arguments in [brackets] are optional. Google Sheets doesn't have this function.

Example

=TEXTAFTER(B2," ") reads: Return everything after the first space in the phone number B2.

CRM export · edit F2 and watch it recalculate
Click a cell (or use the arrow keys) to insert its address · Enter shows the resultF2 = 20 7946 0321
ABCDEF
1CustomerPhoneOrderAmountCityLocal number
2Okafor, Mara+44 20 7946 0321ORD-2026-0412$1,250.00London 20 7946 0321
3Lind, Jonas+46 40 123 456ORD-2026-0413$89.90Malmö40 123 456
4Raman, Priya+91 20 5550 1234ORD-2026-0419$2,040.00 Pune20 5550 1234
5Ruiz, Tomás+34 954 000 111ORD-2026-0420$15.00Seville 954 000 111
6Demir, Elif+90 232 555 0199ORD-2026-0425$310.50Izmir232 555 0199
7Mori, Kenji+81 6 5550 7788ORD-2026-0431$799.00Osaka  6 5550 7788

F2 shows 20 7946 0321: everything after the first space in Mara's phone number.

How the spreadsheet calculates it

The text after a delimiter. Here it's given B2 and " ".

  1. 1. TEXTAFTER: The text after a delimiter. Here it's given B2 and " ".
    • text = `B2`: the cell to cut
    • delimiter = `" "`: the separator, in quotes

More TEXTAFTER examples

  • =TEXTAFTER(B2,"@")The domain of the email in B2.
  • =TEXTAFTER(A2," ",-1)The last word of A2.
  • =TEXTAFTER(A2,"-",1,,,A2)Everything after the first hyphen, or the whole text when there isn't one.

Paste any of these into the formula explainer to see it step by step.

Tips

  • Use a negative instance_num to count from the end: -1 is the last occurrence.
  • Give if_not_found a value (often the original text) so rows without the delimiter don't show #N/A.
  • Pair it with TEXTBEFORE to take the part between two delimiters: TEXTBEFORE(TEXTAFTER(A2, "("), ")").
  • For files that go to Google Sheets or older Excel, use MID and FIND instead.

What TEXTAFTER is used for

Taking the domain from an email address, the last name from “First Last”, the number after a prefix like INV-, or everything after a label in imported text.

Arguments

ArgumentRequiredWhat it is
textYesThe text to search in.
delimiterYesThe character or text to split at, such as " " or ", ".
instance_numNoWhich occurrence to split at; 1 is the first, and a negative number counts from the end.
match_modeNo0 (the default) is case-sensitive; 1 ignores case.
match_endNoTreat the end of the text as a delimiter.
if_not_foundNoWhat to return when the delimiter isn't there, instead of #N/A.

Common mistakes

  • Sharing the file with Google Sheets or Excel 2021 users: they'll see #NAME?.

  • Using it in a file shared with Google Sheets, which doesn't have TEXTAFTER.

  • Using it in Excel 2021 or older, where it isn't available (Excel 2024 and Microsoft 365 only).

In Google Sheets

Google Sheets doesn't have TEXTAFTER (it's missing from Google's function list). Use MID(B2, FIND(" ", B2) + 1, LEN(B2)), or SPLIT to break the text into parts.

Errors you may see with TEXTAFTER

  • #N/A: The delimiter isn't in the text and there's no if_not_found.
  • #NAME?: The file is open in Excel 2021 or older, or in Google Sheets.

Questions

How do I get the text after the last space?

Use instance_num -1: TEXTAFTER(A2, " ", -1) returns the last word.

What works in every version?

MID(text, FIND(delimiter, text) + LEN(delimiter), LEN(text)), shown in clean up messy text.

TEXTAFTER or TEXTSPLIT?

TEXTAFTER returns one piece (after a delimiter); TEXTSPLIT splits the whole text into every piece and spills them. Both need Excel 2024 or Microsoft 365.

Sources

Official documentation the facts on this page were checked against.

Practise TEXTAFTER on a live sheet

Lesson 31, Split names and codes (Unit 8, Cleaning text at scale), has 5 graded exercises, checked instantly, with steps and hints when you're stuck. Pro