Move To New Row After Comma

Nanogirl21

Active Member
Joined
Nov 19, 2013
Messages
331
Office Version
  1. 365
Platform
  1. Windows
I have a list of ingredients in cell A1. Each ingredient is separated by a comma (,). How can I move each ingredient to its own row?

EXAMPLE:

ORIGINAL
CELL A1 = w[FONT=&quot]ater, sodium lauroyl methyl isethionate, glycerin

WANTED
CELL A1 = water
CELL A2 = [/FONT]
[FONT=&quot]sodium lauroyl methyl isethionate[/FONT][FONT=&quot]
CELL A3 = [/FONT]
[FONT=&quot]glycerin
[/FONT]
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Here is a macro that will do it...
Code:
[table="width: 500"]
[tr]
	[td]Sub SplitCommaDelimitedListToIndividualRows()
  Dim Parts() As String
  Parts = Split([A1], ",")
  Range("b2").Resize(UBound(Parts) + 1) = Application.Transpose(Parts)
End Sub[/td]
[/tr]
[/table]
 
Upvote 0
Here is a macro that will do it...
Code:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Sub SplitCommaDelimitedListToIndividualRows()
  Dim Parts() As String
  Parts = Split([A1], ",")
  Range("b2").Resize(UBound(Parts) + 1) = Application.Transpose(Parts)
End Sub[/TD]
[/TR]
</tbody>[/TABLE]


worked perfectly. thank you.
 
Upvote 0
Here is a macro that will do it...
Code:
[table="width: 500"]
[tr]
	[td]Sub SplitCommaDelimitedListToIndividualRows()
  Dim Parts() As String
  Parts = Split([A1], ",")
  Range("b2").Resize(UBound(Parts) + 1) = Application.Transpose(Parts)
End Sub[/td]
[/tr]
[/table]
In thinking about it, we can make my macro a one-liner...
Code:
[table="width: 500"]
[tr]
	[td]Sub SplitCommaDelimitedListToIndividualRows()
  Range("B2").Resize([LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1]) = Application.Transpose(Split([A1], ","))
End Sub[/td]
[/tr]
[/table]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top