How to Extract Text after Second Comma in Excel?

Method 1 – Extract Text after the Second Comma with MID and FIND Functions

We have a dataset containing Teams and Top players. Our main goal is to extract text after the second comma. We’ll extract text from column C in column D.

Extract Text after Second Comma with MID and FIND Functions

Steps:

  • Use the following formula in cell D5:

=MID(C5,FIND(",",C5, FIND(",",C5)+1)+1,256)

  • Press Enter and drag the Fill handle icon.

Extract Text after Second Comma with MID and FIND Functions

  • Here’s the result.

How Does the Formula Work?

  • FIND(“,”,C5, FIND(“,”,C5)+1)+1 finds the second comma in cell C5 and returns that position.
  • The MID(C5, FIND(“,”,C5, FIND(“,”,C5)+1)+1,256) will parse out the text string after the second comma. The first argument specifies the text string in cell C5. The second argument indicates the position of the second comma, followed by the third argument indicating the total number of characters.

Read More: How to Extract Text Before Character in Excel


Method 2 – Using TRIM, MID, and SUBSTITUTE Functions in Excel

We’ll extract text in column D.

How to Extract Text after Second Comma in Excel

Steps:

  • Use the following formula in the cell D5:

=TRIM(MID(C5,FIND("#",SUBSTITUTE(C5,",","#",2))+1,255))

  • Press Enter and drag the Fill handle icon.

How to Extract Text after Second Comma in Excel

  • You will be able to extract text after second comma like the following.

How to Extract Text after Second Comma in Excel

How Does the Formula Work?

  • SUBSTITUTE(C5,”,”,”#”,2) finds out and replaces the second comma with the ‘#‘ Character in cell C5.
  • FIND(“#”,SUBSTITUTE(C5,”,”,”#”,2))+1 provides the position of the ‘#‘ character.
  • The MID function provides the characters of the text string and the TRIM function removes the extra spaces.

Method 3 – Combining RIGHT with LEN and SEARCH Functions

We’ll extract text in column D.

Steps:

  • Use the following combined formula in the cell D5:

=RIGHT(C5,LEN(C5)-(SEARCH(",",C5,SEARCH(",",C5)+1)))

  • Press Enter and drag the Fill handle icon.

How to Extract Text after Second Comma in Excel

  • Here’s the result.

How to Extract Text after Second Comma in Excel

How Does the Formula Work?

  • SEARCH(“,”, C5, SEARCH(“,”, C5) + 1 provides the number of characters at which the second comma is in cell C5.
  • LEN(C5) – (SEARCH(“,”, C5, SEARCH(“,”, C5) + 1 subtracts the number of characters from the text string corresponding to the position of the second comma.
  • The RIGHT function will provide the text after the second comma.

Read More: How to Extract Text after a Specific Text in Excel


Method 4 – Combination of INDEX and FILTERXML Functions to Extract Text

We’ll extract text in column D.

Combination of INDEX and FILTERXML Functions to Extract Text

Steps:

  • Use the following combined formula in the cell D5:

=INDEX(FILTERXML("<a><b>"&SUBSTITUTE(C5,",","</b><b>")&"</b></a>","//b"),3)

  • Press Enter and drag the Fill handle icon.

Combination of INDEX and FILTERXML Functions to Extract Text

  • Here’s the result.

How Does the Formula Work?

  • SUBSTITUTE(C5,”,”,”*/b>*b>”)&”*/b>*/a>”,”//b”) function determines the second comma in the cell C5 and replaces it with the special character.
  • The FILTERXML function divides the text string of cell C5 into delimiters and returns the specific value after the second comma.
  • The INDEX function will provide the text after the second comma.

Read More: How to Extract Text After First Space in Excel


Method 5 – Extract Text after the Second Comma Using IFERROR and MID Functions

We’ll extract text to column D.

Extract Text after Second Comma Using IFERROR and MID Functions

Steps:

  • Use the following combined formula in cell D5:

=IFERROR(MID(C5,FIND(",",C5,FIND(",",C5)+1)+1,256),"")

  • Press Enter and drag the Fill handle icon.

Extract Text after Second Comma Using IFERROR and MID Functions

  • Here’s the result.

How Does the Formula Work?

  • FIND(“,”,C5, FIND(“,”,C5)+1)+1 finds out the second comma in cell C5 and returns that position.
  • The MID(C5, FIND(“,”,C5, FIND(“,”,C5)+1)+1,256) will parse out the text string after the second comma. As you can see, this first argument specifies the text string in cell C5. Secondly, the second argument indicates the position of the second comma, followed by the third argument indicating the total number of characters. The IFERROR function will return a value error if the expression is an error in the value of the expression itself otherwise.

Similar Readings


Method 6 – Utilizing Power Query in Excel

We’ll create a new sheet via Power Query based on the sample dataset.

Utilizing Power Query in Excel

Steps:

  • Go to the Insert tab and select the Table option to convert the dataset into a table.

Utilizing Power Query in Excel

  • When the Create Table dialog box appears, select the dataset and click on OK.

  • This convert the dataset into a table like the following.

Utilizing Power Query in Excel

  • Go to the Data tab and select From Table/Range.

How to Extract Text after Second Comma in Excel

  • You will see the Power Query window as shown below.

  • Select the column from which you would like to extract texts.

How to Extract Text after Second Comma in Excel

  • Select Transform and select Extract.
  • Select Text After Delimiter.

  • When the Text After Delimiter dialog box appears, enter a comma in the Delimiter option and type 1 in the Number of delimiters to skip.
  • Click OK.

  • You will get the output like the following.

  • Go to the Home tab and click on the Close & Load icon.

How to Extract Text after Second Comma in Excel

  • Here’s the resulting sheet.


Download the Practice Workbook


Related Readings


<< Go Back to Extract Text in Excel | String Manipulation | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Saquib Ahmad Shuvo
Saquib Ahmad Shuvo

Saquib Ahmad Bhuiyan, holding a BSc degree in Naval Architecture & Marine Engineering from Bangladesh University of Engineering and Technology, skillfully integrates engineering expertise with a passion for Excel. He provides solutions to complex issues as an Excel & VBA Content Developer for ExcelDemy Forum. He demonstrates an enthusiastic mindset and adeptness in managing critical situations with finesse, showcasing his commitment to excellence. Apart from creating Excel tutorials, he is interested in Data Analysis with MS Excel, Rhinoceros,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo