Share this page : facebooktwitterlinkedinmailfacebooktwitterlinkedinmail

Data tab > Text to columns >

  • Delimited ( if you want to separate by commas, space,etc) > choose the delimiter
  • Fixed Width ( if you want to separate them manually) > click a space to add a separator, double click to remove drag to adjust the position.

> choose the data format ( text, date, etc )

Reference: https://support.office.com/en-us/article/Split-text-into-different-columns-with-the-Convert-Text-to-Columns-Wizard-30B14928-5550-41F5-97CA-7A3E9C363ED7?ui=en-US&rs=en-US&ad=US

With function:

https://support.office.com/en-us/article/Split-text-into-different-columns-with-functions-49ec57f9-3d5a-44b2-82da-50dded6e4a68

 

split by carriage return:

 

Split cell values into multiple columns or rows by carriage return or other delimiters:

1. Select the cells that you want to split their contents.

2. Click Data > Text to Columns, see screenshot:

doc-split-cell-by-carriage-return-1

3. In the Convert Text to Columns Wizard, check Delimited option in step1, see screenshot:

doc-split-cell-by-carriage-return-1

4. Then click Next button, in step 2, check Other option under Delimiters, and in the box beside the Other, press Ctrl + J keys into it, see screenshot:

doc-split-cell-by-carriage-return-1

5. And then click Next button, in step3, click Finish button directly to finish the operations.

doc-split-cell-by-carriage-return-1

6. And the cell contents have been split into multiple columns as following screenshot shown:

doc-split-cell-by-carriage-return-1


arrow blue right bubble Split cells into multiple rows based on carriage returns with VBA code

Sometimes, you need to split the cell values into multiple rows based on the carriage returns as following screenshot shown.

doc-split-cell-by-carriage-return-7 -2 doc-split-cell-by-carriage-return-8

There is no direct way for you to deal with this task in Excel, but, you can create VBA code to solve it.

1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Split cells into multiple rows based on carriage returns

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Sub SplitCells()
'Update 20141024
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
    lLFs = VBA.Len(Rng) - VBA.Len(VBA.Replace(Rng, vbLf, ""))
    If lLFs > 0 Then
        Rng.Offset(1, 0).Resize(lLFs).Insert shift:=xlShiftDown
        Rng.Resize(lLFs + 1).Value = Application.WorksheetFunction.Transpose(VBA.Split(Rng, vbLf))
    End If
Next
End Sub

3. Then press F5 key to run this code, and a prompt box will pop out to remind you select the data range that you want to split, see screenshot:

doc-split-cell-by-carriage-return-1

4. And then click OK, and your selected data has been split into multiple rows based on the carriage returns.