Transform data in List

Hi, I have problem to transform data in to the correct form.
This is example of List witch i need to transform:


There are rule how i want to transform data:
(I need to find everything possition with the same content [line 0] and make group from all [line 1])
Is it possible to do that?

Thanks for help.

David

You actually don’t want to Transpose your lists here. You want two separate lists so you can use List.GroupByKey. Your input list will be [Line 1] and your keys will be [Line 0]. This will group the items from your input list based on their respective key value.

Thanks for advice. When I use List.GroupByKey a get two lists with information what I need. But i still need make one line from groups information.
I will be export it to excel and I want it in one cell.

Count the number of items in each group and use List.Cycle to duplicate the key for each count. Then you can combine your lists back together.

I´m not sure if I understand you correctly. But I´m afraid if I do that i will get same/similar list witch I have in the beginning.
My problem now is make this:


Transform all information from list (0 List, 1 List, 2 List … N List) behind each other in to the one line with separator.
Maybe there are plenty(better) solution, but this will solve my problem.

I see. In that case just use String.Join to merge your values. You’ll still need to do a little list management to keep the same list structure.