1

I am trying to transform a very simple input_table

enter image description here

into this output_table:

enter image description here

I am basically trying to:

  • Get unique items in first column
  • Transpose and promote these items as column headers
  • Get matching values (from the second column in input_table) under each unique header

I am using Power Query because I need the output_table to dynamically update each time I add records to input_table, but any other dynamical solution is accepted (Array Formulas, intermediate Tables, etc...). No VBA.

1 Answer 1

3

Assuming your table is called Table1 and is structured in the way shown in the screenshot, I think this Power Query query should do what you want:

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    ChangedType = Table.TransformColumnTypes(Source,{{"Type", type text}, {"Value", type text}}),
    GroupedRows = Table.Group(ChangedType, {"Type"}, {{"DistinctValues", each _[Value]}}),
    Output = Table.FromColumns(GroupedRows[DistinctValues], GroupedRows[Type])
in
    Output

Chris

Sign up to request clarification or add additional context in comments.

1 Comment

it is exactly what I needed. elegant and concise, an amazing answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.