How to Split Text by Space with Formula in Excel (5 Ways)

We have a sample dataset containing Names. Space is used as a delimiter here. Let’s split the text using formulas in Excel.

Excel Split Text by Space Formula


Method 1 – Combining LEFT and FIND Functions to Split Text by Space in Excel

We will extract the First Name.

Steps:

  • Use the following formula in cell C5.
=LEFT(B5, FIND(" ",B5))

Excel Split Text by Space Formula LEFT FIND

  • Press Enter.

Excel Split Text by Space Formula LEFT FIND

FIND(” “,B5) gives the output as 5 which are number of characters including the Space from the left side of the name. =LEFT(B5, 5) gives us the result as Mary.

  • Drag the Fill Handle down to AutoFill the rest of the series.

Read More: How to Split First And Last Name in Excel


Method 2 – Splitting Text by Space Using Excel MID and FIND Functions

Let’s extract the middle name (surrounded by two spaces).

Steps:

  • Use the following formula in cell D5.
=MID(B5,FIND(" ",B5),FIND(" ",B5,FIND(" ",B5)+1)-FIND(" ", B5))

Excel Split Text by Space Formula MID FIND

  • Press the Enter key.

Excel Split Text by Space Formula LEFT FIND RIGHT SEARCH

  • Drag down the Fill Handle to AutoFill the rest of the series.

Excel Split Text by Space Formula LEFT FIND RIGHT SEARCH

FIND(” “,B5,FIND(” “,B5)+1)-FIND(” “, B5) determines location of the second space. In this case, it is 10. =MID(B5,5,10) gives the result as Elizabeth. 5 is the start number, and 10 means the total number of characters.

Read More: How to Split Text in Excel by Character


Method 3 – Joining Excel RIGHT and SEARCH Functions to Split Text

Let’s get the Last Name.

Steps:

  • Use the following formula in cell E5.
=RIGHT(B5,LEN(B5)-SEARCH(" ",B5,SEARCH(" ",B5,1)+1))

Excel Split Text by Space Formula RIGHT SEARCH

  • Press the Enter key.

Excel Split Text by Space Formula LEFT FIND RIGHT SEARCH

  • Drag down to AutoFill the rest of the series.

SEARCH(” “,B5,SEARCH(” “,B5,1)+1) gives us the output as 15 which is the number of characters including space of Mary and Elizabeth. LEN(B5) yields the result 20. LEN(B5)-SEARCH(” “,B5,SEARCH(” “,B5,1)+1) outputs as 5 (20 minus 15). =RIGHT(B5,5) gives the final result as Smith.

Read More: How to Split Text in Excel Using Formula


Method 4 – Splitting Text by Space with Formula Combining Excel Functions

Steps:

  • Use the following formula in cell C5.
=TRIM(MID(SUBSTITUTE($B5,"",REPT(" ",LEN($B5))),(COLUMNS($B4:B4)-1)*LEN($B5)+1,LEN($B5)))

Excel Split Text by Space Formula TRIM COLUMNS SUBSTITUTE

  • Press the Enter key.

Excel Split Text by Space Formula TRIM COLUMNS SUBSTITUTE

  • Drag to the right to AutoFill the row.

  • Drag down to AutoFill the rest of the series.


Method 5 – Running VBA Macro to Split Text by Space

Steps:

  • Right-click on the sheet name and go to View Code.

  • Copy and paste the VBA code below.

VBA code:

Sub SplitTextbyspace()

Dim Mydataset() As String, Count As Long, J As Variant

For Rnumber = 5 To 10

    Mydataset = Split(Cells(Rnumber, 2), " ")
    Newdest = 3

    For Each J In Mydataset

        Cells(Rnumber, Newdest) = J
        Newdest = Newdest + 1

    Next J

Next Rnumber

End Sub

Excel Split Text by Space Using VBA

  • Press F5 or the play button to run the code.

Here, For Rnumber = 5 To 10 means our row number of the dataset and Newdest=3 represents the first column where the text will split.


Download the Practice Workbook


Related Articles


<< Go Back to Splitting Text | Split in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mahbubur Rahman
Mahbubur Rahman

MAHBUBUR RAHMAN is a leather engineer with a talent for Excel and a passion for VBA programming. To him, programming is like a time-saving wizard, making data manipulation, file handling, and internet interactions a breeze. His skill set extends to SPSS, STATA, Deep Neural Networks, and Machine Learning. Holding a B.Sc in Leather Engineering from Khulna University of Engineering & Technology, he's shifted to become a content developer. In this role, he crafts technical content centred around Excel... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo