How to Extract Text after the Second Space in Excel – 6 Methods

The dataset contains information about Sales Amount and sellers’ performance. To extract text from Column D:


Method 1- Using the MID Function to Extract Text after the Second Space in Excel

STEPS:

  • Create a Helper column.

Use MID Function to Extract Text after Second Space in Excel

  • Select E5 and enter the formula:
=MID(D5,FIND(" ",D5,FIND(" ",D5)+1)+1,256)
  • Press Enter.

Use MID Function to Extract Text after Second Space in Excel

  • Drag the Fill Handle down to see the result in the rest of the cells.

Use MID Function to Extract Text after Second Space in Excel

Formula Breakdown

  • FIND(” “, D5, FIND(” “, D5)+1)+1

The FIND Function finds the spaces in D5 and returns the position of the second space.

  • MID(D5, FIND(” “, D5, FIND(” “, D5)+1)+1,256)

The MID Function extracts the text string after the second space. The first argument is the text string in D5. The second argument refers to the starting position of the second space and the third argument is the number of characters.

Note: To extract text after the second comma or any delimiter, you need to replace the space with the comma or the delimiter as shown below:

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

Read More: How to Extract Text Before Character in Excel


Method 2 – Extracting Text after the Second Space with the TRIM Function

STEPS:

  • Create a Helper column.

Extract Text after Second Space with Excel TRIM Function

  • Select E5 and enter the formula:
=TRIM(MID(D5,FIND("#",SUBSTITUTE(D5," ","#",2))+1,255))
  • Press Enter to see the result.

Extract Text after Second Space with Excel TRIM Function

  • Drag the Fill Handle down to see the result in the rest of the cells.

Extract Text after Second Space with Excel TRIM Function

Formula Breakdown

  • SUBSTITUTE(D5,” “,”#”,2)

The SUBSTITUTE Function finds and replaces the second space with  #  in D5.

  • FIND(“#”,SUBSTITUTE(D5,” “,”#”,2))+1

The FIND Function returns the position of #.

  • TRIM(MID(D5,FIND(“#”,SUBSTITUTE(D5,” “,”#”,2))+1,255))

The MID Function returns the characters in D5 from the position returned by the FIND Function . The TRIM Function removes extra spaces keeping the spaces between words.

NOTE: If you want to extract text after the nth space, you need to replace 2 with the position of the space. For example, if you want to extract text after the 5th space, use the formula below:

=TRIM(MID(D5,FIND("#",SUBSTITUTE(D5," ","#",5))+1,255))

Method 3 – Applying the RIGHT Function in Excel to Take out Text after the Second Space

STEPS:

  • Create a Helper column.

Apply RIGHT Function in Excel to Take out Text after Second Space

  • Enter the formula in E5:
=RIGHT(D5,LEN(D5)-(SEARCH(" ",D5,SEARCH(" ",D5)+1)))
  • Press Enter to see the result.

Apply RIGHT Function in Excel to Take out Text after Second Space

  • Drag down the Fill Handle.

Apply RIGHT Function in Excel to Take out Text after Second Space

Formula Breakdown

  • SEARCH(” “,D5,SEARCH(” “,D5)+1

The SEARCH Function returns the number of characters at which the second space is in D5.

  • LEN(D5)-SEARCH(” “,D5,SEARCH(” “, D5)+1

This formula subtracts the number of characters of the position of the second space from the length of the text string in D5.

  • RIGHT(D5, LEN(D5)-(SEARCH(” “, D5, SEARCH(” “, D5)+1)))

The RIGHT Function returns the text after the second space.

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


Method 4 – Combine the INDEX and the  FILTERXML Functions to Extract Text after the Second Space

STEPS:

  • Create a Helper column.

Combine INDEX and FILTERXML Functions to Pull out Text after Second Space

  • Select E5 and enter the formula:
=INDEX(FILTERXML("<a><b>"&SUBSTITUTE(D5," ","</b><b>")&"</b></a>","//b"),3)
  • Press Enter to see the result in E5.

Combine INDEX and FILTERXML Functions to Pull out Text after Second Space

  • Drag the Fill Handle down to see the result in the rest of the cells.

Combine INDEX and FILTERXML Functions to Pull out Text after Second Space

Formula Breakdown

  • SUBSTITUTE(D5,” “,”</b><b>”)&”</b></a>”,”//b”)

The SUBSTITUTE Function finds and replaces the second space with the special characters in D5.

  • FILTERXML(“<a><b>”&SUBSTITUTE(D5,” “,”</b><b>”)&”</b></a>”,”//b”),3)

This FILTERXML Function splits the text string using delimiters and returns the specific value after the second space from the text string in D5.

  • INDEX(FILTERXML(“<a><b>”&SUBSTITUTE(D5,” “,”</b><b>”)&”</b></a>”,”//b”),3)

The INDEX Function returns the third text after the second space.


Method 5 – Extract Text from the Right in Excel

You we have a text string: ‘Performance is Good’. Extract ‘is Good’:

STEPS:

  • Create a Helper column.

Extract Text from the Right in Excel

  • Enter the formula in E5:
=TRIM(LEFT(RIGHT(SUBSTITUTE(D5," ",REPT(" ",100)),200),200))
  • Press Enter to see the result.

Extract Text from the Right in Excel

  • Use the Fill Handle to copy the formula to the rest of the cells.

Extract Text from the Right in Excel

Formula Breakdown

  • SUBSTITUTE(D5,” “,REPT(” “,100))

The SUBSTITUTE Function looks for the space in D5 and replaces it with repetitive spaces. The REPT Function repeats the space 100 times.

  • LEFT(RIGHT(SUBSTITUTE(D5,” “,REPT(” “,100)),200),200)

This formula returns the specified number of characters after the second space from the right side of the text string in D5.

  • TRIM(LEFT(RIGHT(SUBSTITUTE(D5,” “,REPT(” “,100)),200),200))

The TRIM Function removes extra spaces and returns the text after the second space from the right side.

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


Method 6 – Extracting the Text after the Second Space Using the Excel Power Query

STEPS:

  • Convert the dataset into a table. Select any cell in the dataset. Here, B4.

Draw out Text after Second Space Using the Excel Power Query

  • Go to the Insert tab and select Table.

Draw out Text after Second Space Using the Excel Power Query

  • A Create Table message box will pop up. Check the My table has headers field if your table contains headers. Otherwise, uncheck it. Click OK to proceed.

Draw out Text after Second Space Using the Excel Power Query

  • The dataset will be converted into a table.

Draw out Text after Second Space Using the Excel Power Query

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

Draw out Text after Second Space Using the Excel Power Query

  • The Power Query window containing the table is displayed.

  • Select the column from which you need to extract text. Here, ‘Comment’.

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

  • In the Text After Delimiter dialog box, select Delimiter and enter a single space.

  • Select Advanced options and enter 1 in ‘Number of delimiters to skip‘.

  • Click OK to see the result.

  • Go to the Home tab in the Power Query window and click Close & Load.

You will see texts after the second space in the Comment column in a new sheet.


Similar Readings


Download Practice Book

Download the practice book here.


Related Readings


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

Get FREE Advanced Excel Exercises with Solutions!
Mursalin Ibne Salehin
Mursalin Ibne Salehin

Mursalin Ibne Salehin holds a BSc in Electrical and Electronics Engineering from Bangladesh University of Engineering and Technology. Over the past 2 years, he has actively contributed to the ExcelDemy project, where he authored over 150 articles. He has also led a team with content development works. Currently, he is working as a Reviewer in the ExcelDemy Project. He likes using and learning about Microsoft Office, especially Excel. He is interested in data analysis with Excel, machine learning,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo