Skip to main content

How to convert comma separated text string to list or rows in Excel?

Author: Xiaoyang Last Modified: 2020-07-03
doc convert comma values to list 1

Supposing, you have a list of cell values which are separated by commas, now, you need to convert these comma separated text strings to multiple rows or a column as following screenshot shown. How could split multiple cell values into rows based on comma delimiter at once in Excel?

Convert comma separated text string to rows with VBA code

Convert comma separated text string to rows with Kutools for Excel


Convert comma separated text string to rows with VBA code

The following VBA code may help you to convert multiple comma separated cell values to a column, please do as follows:

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

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

VBA code: Convert comma separated text string to rows or list

Sub RedistributeCommaDelimitedData()
'Updateby Extendoffice
    Dim xArr() As String
    Dim xAddress As String
    Dim Rg As Range
    Dim Rg1 As Range
    On Error Resume Next
    xAddress = Application.ActiveWindow.RangeSelection.Address
    Set Rg = Application.InputBox("please select the data range:", "Kutools for Excel", xAddress, , , , , 8)
    If Rg Is Nothing Then Exit Sub
    Set Rg = Application.Intersect(Rg, Rg.Parent.UsedRange)
    If Rg Is Nothing Then Exit Sub
    Set Rg1 = Application.InputBox("please select output cell:", "Kutools for Excel", , , , , , 8)
    If Rg1 Is Nothing Then Exit Sub
    xArr = Split(Join(Application.Transpose(Rg.Value), ","), ",")
    Rg1.Resize(UBound(xArr) + 1) = Application.Transpose(xArr)
    Rg1.Parent.Activate
    Rg1.Resize(UBound(xArr) + 1).Select
End Sub

3. Then press F5 key to run this code, in the popped out dialog box, select the data range that you want to convert, see screenshot:

doc convert comma values to list 2

4. And click OK, in the following dialog, specify a cell where you want to output the result, see screenshot:

doc convert comma values to list 3

5. Click OK button, the selected comma separated cell values have been converted into a list of rows. See screenshot:

doc convert comma values to list 4


Convert comma separated text string to rows with Kutools for Excel

If you have Kutools for Excel, with its Split Cells utility, you can quickly split the comma separated cell values into multiple rows or columns based on the comma delimiter as you need.

Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. 

After installing Kutools for Excel, please do with following steps:

1. Select the cell values that you want to convert to rows based on the comma separator.

2. Then click Kutools > Merge & Split > Split Cells, see screenshot:

3. In the Split Cells dialog box, select Split to Rows option under the Type section, and then from the Specify a separator section, check Other checkbox and then enter the comma into the text box, see screenshot:

doc convert comma values to list 6 6

4. Then click Ok, and another dialog will pop out to remind you select a cell to put the result, see screenshot:

doc convert comma values to list 7

5. And then click Ok button, the comma separated cells have been split into multiple rows based on the comma delimiter, see screenshot:

doc convert comma values to list 8

Click to know more about this Split Cells feature…

Download and free trial Kutools for Excel Now !


Demo: Convert comma separated text string to rows with Kutools for Excel

Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. Download and free trial Now!

Related articles:

How to split cells into multiple columns or rows by carriage return?

How to split cell values into multiple columns in 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 (3)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
update to work for a single input cell (mentioned by Sid posted before me). Probably a way to do this for both scenarios, but this worked for me, I had the same issue.

Sub RedistributeCommaDelimitedData_singleCell()

'Updateby Extendoffice 201592

Dim xArr() As String

Dim xAddress As String

Dim Rg As Range

Dim Rg1 As Range

On Error Resume Next

xAddress = Application.ActiveWindow.RangeSelection.Address

Set Rg = Application.InputBox("please select the data range:", "Kutools for Excel", xAddress, , , , , 8)

If Rg Is Nothing Then Exit Sub

Set Rg = Application.Intersect(Rg, Rg.Parent.UsedRange)

If Rg Is Nothing Then Exit Sub

Set Rg1 = Application.InputBox("please select output cell:", "Kutools for Excel", , , , , , 8)

If Rg1 Is Nothing Then Exit Sub



' xArr = Split(Join(Application.Transpose(Rg.value), ","), ",") -------- need this if you have multiple input cells in your input range (Rg)

' replace with this for single input cell for Rg:

xArr = Split(Rg.value, ",")

Rg1.Resize(UBound(xArr) + 1) = Application.Transpose(xArr)

Rg1.Parent.Activate

Rg1.Resize(UBound(xArr) + 1).Select



End Sub
This comment was minimized by the moderator on the site
I have a cell with 667 characters, of which 119 are commas.With this VBA code I can't split. Can you help me please?Thank you very much!
This comment was minimized by the moderator on the site
Hi, I have a single row but this formula do not work for single row while it works for multiple rows could you guide on that would be a great help Thanks
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations