Skip to main content

How to split comma separated values into rows or columns in Excel?

Author: Siluvia Last Modified: 2020-04-23

In some cases, you may need to split comma separated values of selected cells into rows or columns. Here we will introduce three methods for you to solve this problem in details.

Split comma separated values into columns with Text to Columns function
Split comma separated values into rows with VBA code
Quickly split comma separated values into rows or columns with Kutools for Excel


Split comma separated values into columns with Text to Columns function

You can apply the Text to Columns function to split comma separated values of selected cells into columns. Please do as follows.

1. Select the range of cells you want to split values into columns, and then click Data > Text to Columns. See screenshot:

2. In the first Convert Text to Columns Wizard dialog box, select the Delimited option, and then click the Next button.

3. In the second Convert Text to Columns Wizard dialog box, only check the Comma box in the Delimiters section, and click the Next button.

4. In the last Convert Text to Columns Wizard dialog box, select a cell for locating the splitting values in the Destination box, and finally click the Finish button. See screenshot:

Now all the values in selected cells which were separated by commas are split to different columns as bellow screenshot shown.

Normally, the Text to columns feature only splits cells into separate columns, if you want to split cells into rows, how can you do?
Here the Kutools for Excel's Split Cells utility can help you quickly split cells by space, comma, new line, other separators or certain width into not only separated rows, but columns in Excel. Download Kutools for Excel now! (30-day free trail)


Split comma separated values into rows with VBA code

For splitting comma separated values into rows, you can apply the following VBA code.

1. Press the Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Applications window.

2. In the Microsoft Visual Basic for Applications window, click Insert > Module. Then copy and paste the below VBA code into the Module window.

VBA code: Split comma separated values into rows

Sub SplitAll()
	Dim xRg As Range
	Dim xRg1 As Range
	Dim xCell As Range
	Dim I As Long
	Dim xAddress As String
	Dim xUpdate As Boolean
	Dim xRet As Variant
	On Error Resume Next
	xAddress = Application.ActiveWindow.RangeSelection.Address
	Set xRg  = Application.InputBox("Please select a range", "Kutools for Excel", xAddress, , , , , 8)
	Set xRg  = Application.Intersect(xRg, xRg.Worksheet.UsedRange)
	If xRg Is Nothing Then Exit Sub
		If xRg.Columns.Count > 1 Then
			MsgBox "You can't select multiple columns", , "Kutools for Excel"
			Exit Sub
			End If
			Set xRg1 = Application.InputBox("Split to (single cell):", "Kutools for Excel", , , , , , 8)
			Set xRg1 = xRg1.Range("A1")
			If xRg1 Is Nothing Then Exit Sub
				xUpdate = Application.ScreenUpdating
				Application.ScreenUpdating = False
				For Each xCell In xRg
					xRet = Split(xCell.Value, ",")
					xRg1.Worksheet.Range(xRg1.Offset(I, 0), xRg1.Offset(I + UBound(xRet, 1), 0)) = Application.WorksheetFunction.Transpose(xRet)
					I = I + UBound(xRet, 1) + 1
				Next
				Application.ScreenUpdating = xUpdate
			End Sub

3. Press the F5 key to run the code. In the popping up Kutools for Excel dialog box, select the cells you want to split, and then click the OK button.

4. In the second popping up Kutools for Excel dialog box, select a cell for locating the splitting values, then click OK.

Then you can see the comma separated values in selected cells are split into rows as bellow screenshot shown.


Quickly split comma separated values into rows or columns with Kutools for Excel

The Split Cells utility of Kutools for Excel can help you split comma separated values into rows or columns easily.

1. Select the cells you need to split, and then click Kutools > Merge & Split > Split Cells. See screenshot:

2. In the Split Cells dialog box, select Split to Rows or Split to Columns in the Type section as you need. And in the Specify a separator section, select the Other option, enter the comma symbol into the textbox, and then click the OK button. See screenshot:

3 .And then another prompt box will pop out to remind you select a cell to output the result, see screenshot:

4. Click OK button, you can see the results as below screenshots shown.

Split to Columns

Split to Rows

  If you want to have a free trial (30-day) of this utility, please click to download it, and then go to apply the operation according above steps.


Demo: Quickly split comma separated values into rows or columns with Kutools for Excel

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

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

Description


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!
Comments (11)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
A jak zmienić kod żeby nie pytał o ustawienie się w A1 i potem aby wynik był np też od A1 w dół
This comment was minimized by the moderator on the site
Hi Bartek,
You mean don't want to pop up the second dialog to select the target cell, and want to specify the target cell in the code directly?
If so, you need to change the following lines.
For example, you need to start outputting results from B1 and automatically fill down.
Please change this line:
Set xRg1 = Application.InputBox("Split to (single cell):", "Kutools for Excel", , , , , , 8)
to
Set xRg1 = Application.Range("B2")
And then remove the next line:
Set xRg1 = xRg1.Range("A1")
This comment was minimized by the moderator on the site
i still cant upload my csv into 365
This comment was minimized by the moderator on the site
Go to excel file Data option -> text to column->delimited -> Done
it will spit comma separated value into individual column
example
id name add
1 Ratnesh myAdd
2,Yog,myAdd
we will apply in the 2nd record it will split record like 1st records,
Thanks,
Ratnesh Sahu
This comment was minimized by the moderator on the site
Go to excel file Data option -> text to column->delimited -> Done
it will spit comma separated value into individual column
example

id name add

1 Ratnesh myAdd

2,Yog,myAdd


we will apply in the 2nd record it will split record like 1st records,


Thanks,
Ratnesh Sahu
This comment was minimized by the moderator on the site
Thanks it helped :)
This comment was minimized by the moderator on the site
This is amazing, thanks for making it free and easy to use!
This comment was minimized by the moderator on the site
Thank you!
This comment was minimized by the moderator on the site
Alternately for separating into rows, use the text to column steps and then copy & paste ->transpose to turn the columns into rows.
This comment was minimized by the moderator on the site
Thanks Jake! This is what I was looking for. :)
This comment was minimized by the moderator on the site
Good one, the utility help me a lot. Thanks for that... :)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations