To return the text after a delimiter in Excel for Microsoft 365 on Windows, use =TEXTAFTER(A2,"-"). This assumes A2 contains the text Order-4827-Blue; the result is 4827-Blue. TEXTAFTER is available in Microsoft 365 and Excel 2024, but not in older perpetual versions such as Excel 2019.
What TEXTAFTER does
TEXTAFTER searches a text value for a specified delimiter, such as a hyphen, comma, space, slash, or word, and returns the characters after it. The delimiter is not included in the result. It is useful when a cell combines information that needs to be separated: an order number from a prefix, a city from a region, or a file name from a folder path.
The function returns text, even if the extracted characters look like a number or date. For example, extracting 4827 from an order code does not automatically make the result a numeric value for calculations. If you need a number, convert it separately, for example with VALUE, after checking that the extracted text is numeric.
TEXTAFTER is the counterpart to TEXTBEFORE. TEXTBEFORE returns the part before a delimiter; TEXTAFTER returns the part after it. Both functions require Microsoft 365 or Excel 2024. They are convenient for formulas that need to adjust automatically as source text changes, unlike manually copying and editing pieces of a string.
How the formula works
The basic syntax is TEXTAFTER(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found]). The first two arguments are required: text is the cell or string to search, and delimiter is the character or sequence marking the boundary. Arguments in square brackets are optional.
- instance_num specifies which occurrence to use. The default is 1, meaning the first occurrence. A negative number searches from the end.
- match_mode controls case matching. The default 0 is case-sensitive; 1 makes the match case-insensitive.
- match_end controls whether the end of the text can count as a delimiter. Its default is 0; 1 allows that behavior.
- if_not_found supplies a value to return when the delimiter is absent. If omitted, Excel returns #N/A.
For example, with Order-4827-Blue in A2, this formula returns Blue: =TEXTAFTER(A2,"-",2). It asks for the text after the second hyphen. The same result can be requested by searching backward for the last hyphen with =TEXTAFTER(A2,"-",-1). In both cases the assumed layout is the value in A2; the returned text is Blue.
Choosing the right delimiter and occurrence
Pick a delimiter that reliably marks the boundary you want. A single character such as a comma is simple, but a multi-character separator works too. With Mina|Sales|West in A2, the formula =TEXTAFTER(A2,"|",2) returns West. The layout is one pipe-separated value in A2, and the formula selects the text after the second pipe. If you instead want everything after the first pipe, omit the instance argument; the result would be Sales|West.
Using a negative instance is helpful when the number of separators varies but the final one is meaningful. Suppose A2 contains C:\Reports\2026\summary.xlsx. With that path in A2, =TEXTAFTER(A2,"\",-1) returns summary.xlsx because the final backslash is the last occurrence. This example treats the backslash as a literal delimiter inside the quoted text. If the desired output is the folder name rather than the file name, select the second-to-last separator instead, provided the path structure is consistent.
When a delimiter may appear inside a value, confirm whether the first or last occurrence represents the actual boundary. In a product label such as item-blue-large, the first hyphen returns blue-large, while the last returns large. Neither choice is universally correct; it depends on how the data is structured.
Handling missing delimiters and letter case
If a delimiter does not appear, TEXTAFTER normally returns #N/A. You can replace that error with a meaningful result using the optional if_not_found argument. With Order-4827-Blue in A2, =TEXTAFTER(A2,"/",1,0,0,"No slash") returns No slash. The assumed input is in A2; because there is no forward slash in that text, Excel returns the supplied fallback rather than an error. A blank string can be used as the fallback when an empty result is more suitable.
Matching is case-sensitive by default. If A2 contains INVx204, then a search for uppercase X does not match the lowercase x under the default setting. To ignore case, use match_mode 1: with INVx204 in A2, =TEXTAFTER(A2,"X",1,1) returns 204. That can help when imported data uses inconsistent capitalization, though it is safer to use case-sensitive matching when uppercase and lowercase delimiters have different meanings.
A fallback only handles a missing delimiter. It does not automatically fix every possible problem in the source data. For example, a misspelled delimiter, an unexpected extra separator, or a blank source cell may require a separate check. If empty inputs should return blank, one option is to test the source cell with IF before running TEXTAFTER.
Cleaning spaces and using results in a worksheet
TEXTAFTER preserves spaces that occur after the delimiter. If A2 contains Department: Sales, the extracted result begins with a space. With that exact text in A2, =TRIM(TEXTAFTER(A2,":")) returns Sales without the leading space. TRIM also removes leading and trailing ordinary spaces and reduces repeated internal spaces to single spaces, so consider whether that change is appropriate for the data.
For a column of records, enter the formula beside the first record and fill it down. In Microsoft 365, a formula referring to an Excel table column can also use a structured reference, and the table will copy the formula to new rows. Check a few results at the beginning, middle, and end of the data before relying on the extracted column for a report or import.
Spilled-array behavior can matter when a formula refers to a range rather than a single cell. Dynamic-array functions can return results for multiple inputs in supported Excel versions, but a spill can be blocked if cells in the output area are not empty. For a straightforward worksheet column, a single-cell reference filled down is often easier to audit.
Common errors and practical checks
#N/A usually means Excel could not find the delimiter, or could not find the requested occurrence. Check for a different character, such as a hyphen versus an en dash, and inspect the source for leading or trailing spaces. Visually similar punctuation is not necessarily the same character. If the delimiter can legitimately be absent, add an if_not_found value rather than hiding unrelated errors with a broad error-handling formula.
#VALUE! can occur when the requested instance number is zero. Instance numbers must identify an occurrence, such as 1 for the first or -1 for the last. Also check that the formula arguments are separated correctly for your Excel settings. The formulas here use commas, as in the standard English-language Excel syntax requested for this page; some regional configurations use semicolons as argument separators.
- Confirm the exact delimiter by copying it from the source when possible.
- Check whether the first or last occurrence is the intended boundary.
- Look for inconsistent capitalization if the default case-sensitive match is used.
- Test blank cells and records with no delimiter before filling the formula down.
- Make sure the destination cells are not formatted or interpreted in a way that obscures the text result.
What to use in older Excel versions
Excel 2019 and earlier do not include TEXTAFTER. For text after the first occurrence of a delimiter, FIND can locate the delimiter and MID can return the remaining characters. With Order-4827-Blue in A2, =MID(A2,FIND("-",A2)+1,LEN(A2)) returns 4827-Blue. The layout assumes the input is in A2 and the hyphen exists; FIND returns its position, adding 1 starts the extraction just after it, and LEN supplies a sufficiently long extraction length.
This older formula is useful for a first delimiter, but it is less readable and requires more work for the last occurrence or for carefully managed missing-delimiter cases. FIND is case-sensitive; SEARCH is an alternative when case-insensitive delimiter matching is needed. These functions are available in older Excel releases, whereas TEXTAFTER itself requires Microsoft 365 or Excel 2024. Excel for the web and Excel for Mac can have different update and interface details, so availability may depend on the license and update channel; the formula examples use Windows Microsoft 365 syntax.
Frequently Asked Questions
Is there a function called TEXTAFTER in Excel?
Yes. TEXTAFTER returns the characters after a specified delimiter. It is available in Microsoft 365 and Excel 2024, but not in Excel 2019 and older perpetual editions.
How do I get everything after the last space?
With the text in A2, use =TEXTAFTER(A2," ",-1). The negative instance number searches from the end and returns the text after the final ordinary space. If the final part may contain leading spaces, wrap the function in TRIM.
How can I return blank when a delimiter is missing?
Use the optional if_not_found argument. For example, with the input in A2, =TEXTAFTER(A2,"-",1,0,0,"") returns an empty string when no hyphen is found. This does not remove errors caused by unrelated issues in the formula.
Does TEXTAFTER return a number?
It returns text. If the extracted characters are a valid number and you need to calculate with them, convert the result with VALUE or another suitable conversion step. Check the output first if the source may contain letters, punctuation, or formatting characters.
Why does my TEXTAFTER formula show #N/A?
Most often, Excel cannot find the specified delimiter or occurrence. Check that the delimiter is the exact character in the cell and that the requested instance exists. Add the optional if_not_found argument if a missing delimiter is an expected part of the data.
Related
- Excel Day School? Meaning and How to Identify One
- Excel Day Number: Serial Dates, Day of Month and Year
- Excel Day Month Year Format: Dates That Display Clearly
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- DAX SUMPRODUCT: Multiply and Sum Values in Power BIDAX does not have a built-in SUMPRODUCT function. To multiply values row by row and add the results,…
- Excel Text Functions List: Names, Uses, and ExamplesExcel’s text functions help you extract, combine, clean, compare, format, and convert text or values. The main functions…
- Today’s Date in Excel: Shortcut and TODAY() FormulaIn Excel for Microsoft 365 on Windows, press Ctrl+; (Control plus semicolon) to insert today’s date as a…
- How to Get the Filter Option in Excel and Use It EasilyTo get the Filter option in Excel, click a cell in your data and select Data > Filter.…
- Filter Excel Table by Color: Steps and TroubleshootingYes. In Excel for Microsoft 365 on Windows, open the filter arrow in the table column containing the…
- Sort Excel Alphabetically: Rows, Columns, and ListsTo sort a list alphabetically in Excel for Microsoft 365 on Windows, select a cell in the column,…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.