Forum Discussion

BO7's avatar
BO7
Regular Visitor
1 year ago
Solved

Separating Values Into Rows

I have a column that contains multiple ID's. The format of each cell is different; for example, I have a cell that looks like this:   [APP1234567APP9876543APP6789012]   I also have cells that loo...
  • SundarRaj's avatar
    1 year ago

    Hi BO7 , here's another solution you could look. Thanks!

    Here's the code:
    let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Texts", type text}}),
    Number = Table.TransformColumns(#"Changed Type",{}, each List.Count(Text.PositionOf(_,"A",Occurrence.All)) + 1),
    ColNumber = List.Max(Number[Texts]),
    ColNames = List.Transform({1..ColNumber}, each "Col" & Text.From(_)),
    Custom1 = #"Changed Type",
    #"Split Column by Delimiter" = Table.SplitColumn(Custom1, "Texts", Splitter.SplitTextByDelimiter("APP", QuoteStyle.Csv), ColNames),
    #"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter",{"Col1"}),
    Custom2 = Table.TransformColumns(#"Removed Columns",{}, each Text.Replace("APP" & _,";","")),
    Custom3 = Table.FromList(List.Combine(Table.ToRows(Custom2)))
    in
    Custom3