Split cell contents into multiple columns or rows based on carriage return
When working with Excel, you may encounter situations where multiple values are stored in a single cell, separated by line breaks or carriage returns. To effectively analyze and manipulate the data, it can be helpful to split the contents of these cells into multiple columns or rows. This guide will walk you through the process step-by-step.
Split cells into multiple columns based on carriage return
If you have a list of cell contents separated by carriage returns and want to split them into multiple columns based on line breaks, as shown in the screenshot below, this section will introduce three effective methods to achieve this.
Using the Text to Columns Feature
Excel’s Text to Columns feature is ideal for splitting cells into multiple columns.
- Select the cells containing the data you want to split.
- Navigate to the "Data" tab and click "Text to Columns".
- In the "Convert Text to Columns Wizard", select "Delimited" and click "Next".
- In step 2, check "Other" option under "Delimiters", click the box next to the "Other" option, press "Ctrl "+ "J" keys, and then click "Next". see screenshot:
- In step3, specify a cell for locating the result, then click "Finish" button directly to finish the operations.
- Now, All the cell contents have been split into multiple columns as following screenshot shown:
Using Kutools for Excel
Kutools for Excel offers an easy-to-use feature that quickly splits cell contents into multiple columns based on specific delimiters, such as commas or carriage returns. With its intuitive interface and simple operation, it makes data processing more efficient and seamless!
- Select the data range that you want to split.
- Click "Kutools" > "Merge & Split" > "Split Cells", see screenshot:
- In the "Split Cells" dialog box, select the "Split to Columns" option under the "Type" section that you need, and then check "New line Symbol" under the "Specify by" section, see screenshot:
- Then click "OK" button, and a prompt box will pop out to remind you select a cell to output the result, see screenshot:
- Click "OK", all the selected cell values have been split into multiple columns by the carriage return, see screenshot:
Using TEXTSPLIT function (Excel 365)
For Excel 365 users, the TEXTSPLIT function provides a dynamic way to split cells.
Enter the below formula into a blank cell to output the result, press "Enter" to split the text into columns automatically. And then, drag the formula cell down to fill other cells, see screenshot:
=TEXTSPLIT(A1, CHAR(10))
Split cells into multiple rows based on carriage return
If you need to split cell contents containing multiple lines of text separated by carriage returns into individual rows as following screenshot shown. Excel provides several efficient methods to accomplish this. In this section, we will explore these techniques step by step to help you choose the best solution for your needs.
Using the VBA code
For users comfortable with macros, VBA provides a powerful solution.
- Hold down the "ALT" + "F11" keys, and it opens the "Microsoft Visual Basic for Applications" window.
- Click "Insert" > "Module", and paste the following code in the "Module" Window.
VBA code: Split cells into multiple rows based on carriage returnsSub SplitCells() 'Update by Extendoffice 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
- 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:
- Then click "OK", and your selected data has been split into multiple rows based on the carriage returns.
Using Kutools for Excel
Kutools for Excel provides a simple and efficient way to complete the splitting process in just a few steps. Here are the detailed steps:
- Select the data range that you want to split.
- Click "Kutools" > "Merge & Split" > "Split Data to Rows", see screenshot:
- In the "Split Dta to Rows" dialog box, select "New line" under the "Delimiter" section.
- Then, click "OK" button. All the cells are split into multiple rows based on the carriage returns.
Using TEXTSPLIT function (Excel 365)
The TEXTSPLIT function can also split cells into rows dynamically.
Enter the below formula into a blank cell to output the result, press "Enter" to split the text into rows automatically. see screenshot:
=TRIM(TEXTSPLIT(TEXTJOIN(CHAR(10),,A1:A4),,CHAR(10)))
- TEXTJOIN(CHAR(10),,A1:A4)
Combines all the values in the range A1:A4 into a single text string, separated by line breaks (CHAR(10)), while ignoring empty cells. - TEXTSPLIT(...,,CHAR(10))
Splits the combined text string into individual values wherever a line break (CHAR(10)) occurs, returning an array of these values. - TRIM(...)
Removes any extra spaces from the start or end of each value in the resulting array.
Each method has its advantages depending on your version of Excel and familiarity. By choosing the right approach, you can easily manipulate your data to meet your requirements. If you're interested in exploring more Excel tips and tricks, our website offers thousands of tutorials, Thank you for reading, and we look forward to providing you with more helpful information in the future!
Related Articles:
- Split a large table into multiple small tables
- If you have a large Excel table with multiple columns and hundreds or thousands of rows, you may want to split it into smaller, more manageable tables. For instance, you might need to separate the data based on specific column values or divide it into chunks of a fixed number of rows. This tutorial provides step-by-step methods to accomplish this task efficiently.
- Split a column every other row
- For example, I have a long list of data, and now, I want to split the column into two lists equally by every other row as following screenshot shown. Are there any good ways to deal with this task in Excel?
- Split full name to first and last name
- Supposing you have a name roster as the first screen shot shows in single column below, and you need to split the full name to the first name column, middle name column and last name column as the following screenshot shown. Here are some tricky methods to help you solve this problem.
- Separate text and numbers from one cell into two columns
- If you have a column of text strings which are composed of text and numbers, now, you would like to separate the text and numbers from one cell into two different cells as following screenshot shown. In Excel, you can finish this task with these methods.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
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!
Table of contents
- Split cells into multiple columns based on carriage return
- With Text to Column feature
- With Kutools for Excel
- With TEXTSPLIT function (Excel 365)
- Split cells into multiple rows based on carriage return
- With VBA code
- With Kutools for Excel
- With TEXTSPLIT function (Excel 365)
- Related Articles
- The Best Office Productivity Tools
- Comments