Below is a small sample of the data set I am working with.
I figured out I can use TEXTSPLIT(D2,,",") to split a comma delimited cell and get the individual AHNs in a vertical format but I want to create a formula that I can apply to the entire data set and get something like below in a separate sheet.
The issue as you've probably figured out is for a cell with multiple comma separated values, the split cell spills down multiple rows. I could manually go through the list and copy and paste vertically into a new sheet but I am curious if there is a better way using excel formulas/macros.
Here is one way using Excel Formulas
if using MS365
then the following should work, also it can be accomplished using Power Query
=LET(
α, A2:B7,
DROP(REDUCE(0,SEQUENCE(ROWS(α)),LAMBDA(φ,δ,
VSTACK(φ,IF({1,0},INDEX(α,δ,0),TEXTSPLIT(INDEX(α,δ,2),,", "))))),1))
However, using POWER QUERY
will be the easiest and neat approach.
To perform the above task, follow the steps:
Table1
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(Source, {{"Agreement AHN", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Agreement AHN")
in
#"Split Column by Delimiter"