To return everything after the first comma in cell A2 in Microsoft 365, use =TEXTAFTER(A2,","). To remove the space often left after the comma, use =TRIM(TEXTAFTER(A2,",")); for example, if A2 contains Jordan Lee, Sales, the result is Sales.
The simplest formula for text after a comma
Put the formula in an empty cell, such as B2, and replace A2 with the cell containing your data. With the value Jordan Lee, Sales in A2, =TEXTAFTER(A2,",") returns a leading space followed by Sales. Wrapping the result in TRIM removes that extra space, making =TRIM(TEXTAFTER(A2,",")) a useful default when the comma is followed by a normal space.
TEXTAFTER is available in Microsoft 365 and Excel 2024. It searches for the delimiter you provide—in this case, a comma—and returns the text on the other side of it. The formula returns everything after the first matching comma, not just the next word. If A2 contains Jordan Lee, Sales, West, the trimmed result is Sales, West.
Enter the formula in the first result row and press Enter. To apply it to rows below, select the formula cell and use the fill handle at its lower-right corner, or use Ctrl+D on Windows (Control+D on Mac) to fill a selected range down. The formula adjusts its cell reference as it fills, so the next row refers to A3, then A4, and so on.
What happens when a cell contains several commas?
By default, TEXTAFTER uses the first occurrence of the delimiter. That distinction matters when the cell contains several fields. If A2 is Lee, Jordan, Sales, the basic formula returns Jordan, Sales, not only Jordan. It is returning the entire remainder of the cell after the first comma.
If the value you need is everything after the final comma, tell TEXTAFTER to search for the last occurrence. With the complete text in A2, use =TRIM(TEXTAFTER(A2,",",-1)). For Lee, Jordan, Sales, that returns Sales. The -1 argument means the last matching delimiter; a positive 1 means the first. This is useful for extracting a final category or region, but only when the last comma reliably marks the boundary you want.
For a fixed number of fields, consider splitting at every comma rather than extracting one remainder. This also makes it easier to see how the source is structured before deciding which part to use.
Split all comma-separated parts into separate columns
TEXTSPLIT separates text at each instance of a delimiter and returns the pieces in neighboring cells. With the full string in A2, enter =TEXTSPLIT(A2,",") in B2. If A2 contains Jordan Lee, Sales, West, the results spill across three cells: B2 contains Jordan Lee, C2 contains Sales, and D2 contains West. The spaces after the commas are part of those results.
To trim spaces from each returned piece, with the same value in A2, use =TRIM(TEXTSPLIT(A2,",")). In versions with dynamic arrays, the results spill across the row as separate values. Make sure the cells where the results need to appear are empty; otherwise, Excel may show a #SPILL! error. TEXTSPLIT is available in Microsoft 365 and Excel 2024.
TEXTSPLIT is a good choice when the number of comma-separated parts varies or you want every part in its own column. TEXTAFTER is simpler when you want only the remainder after one particular comma. Neither function understands whether a comma is being used as a true separator or as part of a value, so check the source format before splitting.
Choose the right comma when data has more than one
Before settling on a formula, decide which comma separates the information you need. A name might be stored as surname, given name, while an address might contain commas between the street, city, and region. Extracting after the first comma in an address could return several location components; extracting after the last could return only the final one. The right result depends on the meaning of the fields, not just on where a comma appears.
- Everything after the first comma: use TEXTAFTER with its default behavior.
- Everything after the last comma: use TEXTAFTER with an instance number of -1.
- Every segment in its own cell: use TEXTSPLIT.
- Only the next field between two commas: split all parts, or combine TEXTBEFORE and TEXTAFTER when the field positions are consistent.
For example, with Lee, Jordan, Sales in A2, the formula =TEXTBEFORE(TEXTAFTER(A2,","),",") returns the middle field, including its leading space. To clean that field, use =TRIM(TEXTBEFORE(TEXTAFTER(A2,","),",")). This nested approach assumes there are at least two commas. If records do not have a consistent number of separators, split the full value and inspect the resulting columns instead.
Handle missing commas and messy spaces
If TEXTAFTER cannot find the comma, it returns #N/A. That is often a helpful sign that a row does not match the expected format. If a missing comma should produce a blank instead, with source text in A2, use =IFERROR(TRIM(TEXTAFTER(A2,",")),""). This handles the missing-delimiter case, although IFERROR also hides other errors. Use it when a blank is an acceptable result rather than when you need to investigate every problem.
TRIM removes leading and trailing ordinary spaces and reduces repeated spaces between words to single spaces. It does not remove every character that can look like a space. Data copied from a website or another system may contain nonbreaking spaces. With the source string in A2, use =TRIM(SUBSTITUTE(TEXTAFTER(A2,","),CHAR(160)," ")) to replace those characters with ordinary spaces before trimming.
Also check for inconsistent punctuation. A row ending in a comma, one with no comma, or one with a semicolon instead may produce an empty result, an error, or an unexpected remainder. If the delimiter is not always the same, first standardize the source or use a formula designed for the actual pattern; changing a comma formula blindly can hide bad records.
Use a formula in older Excel versions
TEXTAFTER and TEXTSPLIT are not available in some older desktop versions of Excel. A traditional formula can extract the text after the first comma using MID, FIND, and LEN. With the source value in A2, enter =MID(A2,FIND(",",A2)+1,LEN(A2)). For Jordan Lee, Sales, it returns Sales; add TRIM to remove the initial space: =TRIM(MID(A2,FIND(",",A2)+1,LEN(A2))).
FIND locates the comma, and adding 1 starts the extraction immediately after it. LEN supplies a length large enough to reach the end of the cell. This method extracts after the first comma; it does not automatically switch to the last comma. If the comma is absent, FIND returns an error, so a blank-on-error version is =IFERROR(TRIM(MID(A2,FIND(",",A2)+1,LEN(A2))),"").
These formulas work in older Excel versions that support the underlying functions, including Excel 2016 and later. They are less direct than TEXTAFTER, and nested formulas can become harder to maintain when the rules change. If you regularly process changing or multi-part text, upgrading to a version with the newer text functions or using Excel’s built-in import tools may be easier.
Formula versus Text to Columns
A formula is useful when the source values change and you want the extracted result to update automatically. It also leaves the original column intact, which is helpful for review and correction. TEXTAFTER can return a single remainder, while TEXTSPLIT can create a dynamic set of columns without manually repeating a formula.
Text to Columns is a better fit for a one-time conversion of a selected range. In Excel for Microsoft 365 on Windows, select the cells, then choose Data > Text to Columns. Choose Delimited, select Comma as the delimiter, and complete the wizard. Excel places the separated values in columns, so make sure the destination cells are empty or choose a different destination to avoid overwriting existing data. On Mac, the Text to Columns command is also on the Data tab; the exact dialog appearance can vary by Excel release.
Unlike a formula, Text to Columns changes the selected data into separated values rather than maintaining a live relationship with the original text. Make a copy of the source column first if you may need to restore it. For repeated imports, formulas or Power Query can provide a more repeatable process; the best option depends on whether you need a live result, a one-time change, or a refreshable data-cleaning workflow.
Common mistakes to check before relying on the result
- Forgetting the space: TEXTAFTER returns the characters exactly as they follow the comma. Wrap it in TRIM when you do not want a leading space.
- Assuming it returns only one word: it returns everything after the selected delimiter, including any later commas.
- Overwriting data: TEXTSPLIT needs empty cells to the right of its formula so the results can spill.
- Using commas as separators inside quoted data: a simple delimiter formula will split those commas too. For example, a CSV field such as
"North, West"may need proper CSV import handling rather than a basic split. - Seeing a formula error in a regional setup: some Excel regional settings use semicolons between function arguments. The examples here use commas as requested; if Excel rejects a formula, check the list separator settings used by your installation.
For important lists, test a few representative rows before filling the formula down. Include a normal row, one with multiple commas, one with extra spaces, and one with a missing delimiter. Comparing those results to the intended fields can reveal a bad assumption before it affects a whole workbook.
Frequently Asked Questions
How do I extract everything after the first comma in Excel?
With the text in A2, use =TEXTAFTER(A2,","). Add TRIM if you want to remove a leading space: =TRIM(TEXTAFTER(A2,",")).
How do I extract everything after the last comma?
With the full value in A2, use =TRIM(TEXTAFTER(A2,",",-1)). The -1 tells TEXTAFTER to use the final matching comma.
How do I split a cell at every comma?
With the value in A2, enter =TEXTSPLIT(A2,",") in an empty cell. The parts spill into adjacent columns. Use =TRIM(TEXTSPLIT(A2,",")) to remove ordinary spaces around the parts.
Why does TEXTAFTER return #N/A?
The delimiter may be missing from the referenced cell. Check the source value and confirm it contains the comma you are searching for. If a missing comma should yield a blank, use IFERROR around the formula, while remembering that this also suppresses other errors.
Can I split text after a comma in older Excel?
Yes. With the text in A2, use =TRIM(MID(A2,FIND(",",A2)+1,LEN(A2))). It extracts after the first comma and works in older versions that do not include TEXTAFTER.
Related
- Excel and Outlook Not Responding? Causes and Fixes
- Excel Page Breaks for Printing: How to Add Them Easily
- Excel Dropdown List: How to Select Multiple Items
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Copy Values in Excel: Keep Results, Not FormulasTo copy only the displayed results of cells in Excel, copy the source range, select the destination’s top-left…
- Excel Sum Rows Based on Cell Value: Formulas That WorkTo total values in rows where a cell matches a condition, use Excel’s SUMIF function. With categories in…
- Excel Column Compare: Find Differences With FormulasTo compare values on the same rows in Excel, put this formula in C2 when the two columns…
- VLOOKUP in Excel: Steps, Examples, and Common FixesTo use VLOOKUP in Excel, put the value you want to find in a cell, then enter a…
- Excel Formula for Quarterly Dates: Examples and TipsTo calculate the first day of the calendar quarter containing a date in A2, use =DATE(YEAR(A2),3*INT((MONTH(A2)-1)/3)+1,1). For example,…
- Excel ROUND DOWN to Whole Number: Formulas and ExamplesTo round a number down to a whole number in Excel, use ROUNDDOWN with zero decimal places. If…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.