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).


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
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.
    demo · 4 months ago
    how do I do this from right to left. Basically, want to extract last two words.
    • To post as a guest, your comment is unpublished.
      skyyang · 2 months ago
      Hi, demo,
      To extract and return the last two words from text strings, please apply the below formula:
      =IF((LEN(A1)-LEN(SUBSTITUTE(A1," ","")))<2,A1,RIGHT(A1,LEN(A1)-FIND("/",SUBSTITUTE(A1," ","/",(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))-1)))))

      Please try, hope it can help you!
  • To post as a guest, your comment is unpublished.
    Alessandro · 10 months ago
    THANK YOU!!!
  • To post as a guest, your comment is unpublished.
    Tiki · 1 years 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 · 1 years 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 · 7 months 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 · 2 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 · 2 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!
  • To post as a guest, your comment is unpublished.
    Guni · 2 years ago
    Hi, this formula will be ideal for but instead of removing text after second space i want remove everything after 3rd i have been trying insert 3rd FIND(" ",A2 i understand that the formula itself is =FIND(" ",X13,1). can you please help me out. I am not good with nesting the formulas.

    Thank you very much.