Splitting data in a table into another table with different size

ijhoeq

Board Regular
Joined
Jun 20, 2018
Messages
61
AB
1Part Number
Name
2ABC123C1,C2,C3,C15
3XYZ321J1
4IJK100L1,L2

<tbody>
</tbody>

Hello,

I have data like the table above (with many more rows and longer names) and I need to break the Name column so that each name is separate with the Part Number listed next to it. An example of what I want to produce is shown below. Any help would be greatly appreciated!

AB
1Part Number
Name
2ABC123C1
3ABC123C2
4ABC123C3
5ABC123C15
6XYZ321J1
7IJK100L1
8IJK100L2

<tbody>
</tbody>
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
with Power Query

Part NumberNamePart NumberName
ABC123C1,C2,C3,C15ABC123C1
XYZ321J1ABC123C2
IJK100L1,L2ABC123C3
ABC123C15
XYZ321J1
IJK100L1
IJK100L2

Code:
[SIZE=1]// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Split = Table.ExpandListColumn(Table.TransformColumns(Source, {{"Name", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Name")
in
    Split[/SIZE]
 
Upvote 0
Run this macro, the result in columns D and E

Code:
Sub Splitting_data()
  Dim c As Range, s As Variant, i As Long
  i = 2
  For Each c In Range("B2", Range("B" & Rows.Count).End(xlUp))
    For Each s In Split(c, ",")
      Cells(i, "D").Value = c.Offset(, -1)
      Cells(i, "E").Value = s
      i = i + 1
    Next
  Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,818
Messages
6,121,725
Members
449,049
Latest member
MiguekHeka

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