Creating a list from text data in spreadsheet

ajbruff

New Member
Joined
Feb 22, 2020
Messages
4
Office Version
  1. 2016
Platform
  1. Windows
Hi

This has got me flummoxed and half the problem is I don't know what to search for for help.

I have a table which is similar to the one below.

AssetOccupier
Anmer HallPrince William
Buckingham PalaceQueen Elizabeth
BalmoralQueen Elizabeth
BirkhallPrince Charles
Kensington PalacePrince William
HighgrovePrince Charles
SandringhamQueen Elizabeth

I would like to get the data so I can see which occupiers have occupy which properties as shown below:

Queen ElizabethPrince CharlesPrince William
Buckingham PalaceBirkhallAnmer Hall
BalmoralHighgroveKensington Palace
Sandringham

Any advice on how to do this would be much appreciated.

Regards


Bruffster
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
try Power Query (Get&Transform)
AssetOccupierPrince WilliamQueen ElizabethPrince Charles
Anmer HallPrince WilliamAnmer HallBuckingham PalaceBirkhall
Buckingham PalaceQueen ElizabethKensington PalaceBalmoralHighgrove
BalmoralQueen ElizabethSandringham
BirkhallPrince Charles
Kensington PalacePrince William
HighgrovePrince Charles
SandringhamQueen Elizabeth

Code:
// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Group = Table.Group(Source, {"Occupier"}, {{"Count", each _, type table}}),
    List = Table.AddColumn(Group, "List", each Table.Column([Count],"Asset")),
    Extract = Table.TransformColumns(List, {"List", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
    RC = Table.RemoveColumns(Extract,{"Count"}),
    Split = Table.SplitColumn(RC, "List", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"List.1", "List.2", "List.3"}),
    Transpose = Table.Transpose(Split),
    Promote = Table.PromoteHeaders(Transpose, [PromoteAllScalars=true])
in
    Promote
 
Upvote 0
Hi Sandy

Thanks for your swift reply. I must admit, i'm not a techy so i'm not sure how to use the code. Can I get the result you got through the power query window?

Best wishes

Bruffster
 
Upvote 0
select your source table (blue)
Data - From Table
it will open PQ Editor
open Advanced Editor
check if the name there is the same as in the code from post (Table1)
if so replace whole code in Advanced Editor with code copied from the post
Done
Close&Load
 
Upvote 0
You are most welcome
Thanks for the feedback

btw. it works with your example, with another structure you'll need do these steps manually
 
Upvote 0
Hi
A variant
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    prepare = Table.Group(Source, {"Occupier"}, {"temp", each [Asset]}),
    result = Table.FromColumns(prepare[temp], prepare[Occupier])
in
    result
Regards,
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,356
Members
449,080
Latest member
Armadillos

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