How to Split Columns with Power Query with Variable Delimiters

How to Split Columns with Power Query with Variable Delimiters

Excel On Fire

6 лет назад

16,248 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@SimX9000
@SimX9000 - 05.09.2021 19:41

This level of automation is amazing, thank you so much for making these kind of videos.

Ответить
@mrpage221
@mrpage221 - 11.03.2020 14:06

Great video. I am new to Power Query and the video was exactly what I needed. Thanks, Oz.

Ответить
@stevennye5075
@stevennye5075 - 16.12.2019 05:10

Nice!

Ответить
@enricogalli3744
@enricogalli3744 - 26.10.2019 10:00

Thanks a lot for this one, and for linking to other solutions. I used to just delete the generated columns list as Imke suggested at first, and was not aware of the fact that this way it took the first row as a template! (*broken fingers sound*). Now I know several approaches to tackle this issue (which is still there and quite unbelievably so)


I'll add a slight variation which does not require for the word "Team" to be included in the team name, by duplicating the column, extracting all before first delimiter in the first one and all after first delimiter in the second one:


let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Duplicate_column = Table.DuplicateColumn(Source, "TEAMS", "Members"),
Team_name = Table.TransformColumns(Duplicate_column, {{"TEAMS", each Text.BeforeDelimiter(_, ", "), type text}}),
Member_list = Table.TransformColumns(Team_name, {{"Members", each Text.AfterDelimiter(_, ", "), type text}}),
Split = Table.TransformColumns(Member_list,{{"Members", Splitter.SplitTextByDelimiter(", ")}}),
Expanded = Table.ExpandListColumn(Split, "Members")
in
Expanded

Ответить
@Kindabizzare
@Kindabizzare - 27.09.2019 02:53

Thanks! , Can't lie I jumped when that explosion went off LOL . .. Good Stuff subscribing now!

Ответить
@mehdihammadi6145
@mehdihammadi6145 - 02.09.2019 18:38

Love it and thank you for sharing

Ответить
@syedaliraza1120
@syedaliraza1120 - 10.06.2019 15:17

Thats an awesome trick. Thank you for sharing.

I have 3 rows available like this and i want this to split into columns not in rows. Is that possible?

ROW1: Kevin,Kevin,Kevin,Kevin,Pete,Pete,Pete,Nathan,Nathan,Luke
ROW2: Jon,Jon,Jon,Edward,Kyle,Kyle,Max
ROW3: Joe,Austin,Austin,Sam,Sam,Sam

Ответить
@QuickMadeUpName
@QuickMadeUpName - 12.11.2018 03:48

Is this still a thing to account for within Power Query? This doesn't seem very user friendly and is not expected behavior. Probably a lot of people will be running into issues with Power Query because of things like this. Good video, just too bad Power Query doesn't operate in the expected manner.

Ответить
@farazshaikh74
@farazshaikh74 - 16.08.2018 00:20

GURU JI.. you are awesome.. no words..

Ответить
@arenddickman4037
@arenddickman4037 - 29.04.2018 23:54

Hello, Oz. Super movie ! I've learned a lot of cool things from you.
You inspire me.
I thought: what if the name of the team will be, for example, "Dinosaurs" or "Rats"?

I came up with such a simple solution
1. On Column TEAM : Split by delimiter >>> option: “Custom” & “, “ and Split at Left-most delimiter
2. On (new) Column TEAM.2 : Split by delimiter >>>>option : “Custom” & “, “ Advanced option Rows
3. Rename columns TEAM.1 and TEAM.2
READY !
Greetings from Poland

Ответить
@MRSEXY4EVER
@MRSEXY4EVER - 09.04.2018 23:25

Caught my fingers and this is exactly what I needed. Thank you!

Ответить
@fernandomachadorocha7001
@fernandomachadorocha7001 - 11.02.2018 16:01

I never imagine this at power quert,thanks a lot of.

Ответить
@entertainmentgalaxy971
@entertainmentgalaxy971 - 10.01.2018 21:11

Super trick

Ответить
@MrDoubleYa
@MrDoubleYa - 06.12.2017 19:08

You could also split by columns to initially get the Team Number then split by Rows to get the list of players. This also works with updates because the "split by rows" does not store the row count like "split by columns"

Ответить
@EricGiroux
@EricGiroux - 03.11.2017 00:34

Hi Oz,

Thank you, great video...i like your theatrical approach to teach excel! ;-) Below is my take on the problem, of course your solution amended my Marcel"s suggestion has fewer steps but anyway I thought i should share...

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Added Custom" = Table.AddColumn(Source, "count_comma", each List.Count(List.PositionOfAny(Text.ToList([TEAMS]),{","},Occurrence.All))),
nb_col = #"Added Custom"[count_comma],
#"Split Column by Delimiter" = Table.SplitColumn(#"Added Custom", "TEAMS", Splitter.SplitTextByDelimiter(", ", QuoteStyle.Csv), List.Max(nb_col)+1),
#"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter",{"count_comma"}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Removed Columns", {"TEAMS.1"}, "Attribute", "Value"),
#"Removed Columns1" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns1",{{"TEAMS.1", "TEAMS"}})
in
#"Renamed Columns"

Ответить
@excelisfun
@excelisfun - 01.11.2017 02:09

Hot tip!

Ответить
@mohamedchakroun4973
@mohamedchakroun4973 - 31.10.2017 13:57

Thanks Oz very Nice tricks and Handy
is there a link to the workbook?

Ответить