Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to extract text before / after the second space or comma in Excel? 

In Excel, the Text To Columns function may help you to extract each text from one cell into separate cells by space, comma or other delimiters, but, have you ever tried to extract the text before or after the second space or comma from a cell in Excel as following screenshot shown? This article, I will talk about some methods to deal with this task.

doc extract before second space 1

Extract text before the second space or comma with formula

Extract text after the second space or comma with formula


Split Cell values into multiple columns and rows by specific separator:
With Kutools for Excel’s Split Cells utility, you can quickly split text string in a cell into multiple columns or rows by space, comma, new line and any other separators you specified.
doc split cells-1-1

arrow blue right bubble Extract text before the second space or comma with formula


To get the text before the second space, please apply the following formula:

Enter this formula: =IF(ISERROR(FIND(" ",A2,FIND(" ",A2,1)+1)),A2,LEFT(A2,FIND(" ",A2,FIND(" ",A2,1)+1))) into a blank cell where you want to locate the result, C2, for example, and then drag the fill handle down to the cells that you want to contain this formula, and all the text before the second space has been extracted from each cell, see screenshot:

doc extract before second space 2

Note: If you want to extract the text before the second comma or other separators, please just replace the space in the formula with comma or other delimiters as you need. Such as: =IF(ISERROR(FIND(",",A2,FIND(",",A2,1)+1)),A2,LEFT(A2,FIND(",",A2,FIND(",",A2,1)+1))).


arrow blue right bubble Extract text after the second space or comma with formula

To return the text after the second space, the following formula can help you.

Please enter this formula: =MID(A2, FIND(" ", A2, FIND(" ", A2)+1)+1,256) into a blank cell to locate the result, and then drag the fill handle down to the cells to fill this formula, and all the text after the second space has been extracted at once, see screenshot:

doc extract before second space 3

Note: If you want to extract the text after the second comma or other separators, you just need to replace the space with comma or other delimiters in the formula as you need. Such as: =MID(A2, FIND(",", A2, FIND(",", A2)+1)+1,256).


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Alessandro · 3 months ago
    THANK YOU!!!
  • To post as a guest, your comment is unpublished.
    Tiki · 8 months ago
    Is there a way to extract various pieces of this string? 123ABC.01.02.03.04 ---- for example, to pull the 123ABC, and then in the next column pull 123ABC.01, and then 123ABC.01.02, then 123ABC.01.02.03, and so on.
  • To post as a guest, your comment is unpublished.
    Archi · 1 years ago
    Hi, is there a way, if I want to select text after 3rd comma from the end?
    • To post as a guest, your comment is unpublished.
      skyyang · 10 months ago
      Hi, Archi,
      To extract all text after the 3rd comma, please apply this formula:
      =RIGHT(A1,LEN(A1)-FIND("@@@",SUBSTITUTE(A1,",","@@@",3)))

      Please try it.
  • To post as a guest, your comment is unpublished.
    Dave · 1 years ago
    =IF(ISERROR(FIND(",",A2,FIND(",",A2,1)+1)),A2,LEFT(A2,FIND(",",A2,FIND(",",A2,1)+1)))
    That will return all text left of the second comma plus the second comma. This should be

    =IF(ISERROR(FIND(",",A2,FIND(",",A2,1)+1)),A2,LEFT(A2,FIND(",",A2,FIND(",",A2,1)+1)-1))
    to omit the second comma

    1. Saquon Barkley, RB, Penn State
    2. Derrius Guice, RB, LSU
    3. Sony Michel, RB, Georgia
    4. Ronald Jones II, RB, USC
    5. Nick Chubb, RB, Georgia

    Bad:
    1. Saquon Barkley, RB,
    2. Derrius Guice, RB,
    3. Sony Michel, RB,
    4. Ronald Jones II, RB,

    Better:
    1. Saquon Barkley, RB
    2. Derrius Guice, RB
    3. Sony Michel, RB
    4. Ronald Jones II, RB
    • To post as a guest, your comment is unpublished.
      Ron · 29 days ago
      But this won't work if the text string does NOT always have a second comma...
  • To post as a guest, your comment is unpublished.
    Rodney · 1 years ago
    How would you change this to the 3rd comma? Instead of the 2nd?
    • To post as a guest, your comment is unpublished.
      skyyang · 1 years ago
      Hello,Rodney,
      To extract the text before the 3rd space, please apply this formula:
      =IF(ISERROR(FIND(" ",A2,FIND(" ",A2,FIND(" ",A2,1)+1) +1)),A2,LEFT(A2,FIND(" ",A2,FIND(" ",A2,FIND(" ",A2,1)+1) + 1)));
      To extract the text after the 3rd space, please use this formula:
      =MID(A2, FIND(" ", A2,FIND(" ", A2, FIND(" ", A2)+1) +1)+1,30000)
      Please try it, hope it can help you!
      Thanks!