• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Dynamic table creation

davidsch

New Member
I need to convert a 16-column horizontal table to a 3-column vertical table. I would prefer to do this action via functions and not VBA.
  • Each row in the current table represents one product. Columns represent product attributes.
  • In the new table, each row should represent a product/attribute pair.
  • I will incorporate the solution into a template where the number of products in the horizontal table can vary significantly.
Any thoughts on how to solve this are appreciated.

CURRENT TABLE STRUCTURE
Product CodeCostPass ThroughAttribute 3Attribute 4...Attribute 15
ABCD1
ABCD2
DESIRED TABLE STRUCTURE
Product CodeAttributeValue
ABCD1Cost
ABCD1Pass Through
ABCD1Attribute 3
ABCD1Attribute 4
ABCD1...Attribute 15
ABCD2Cost
ABCD2Pass Through
ABCD2Attribute 3
ABCD2Attribute 4
ABCD2...Attribute 15

 
Last edited:
unpivot your data with Power Query
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Product Code"}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"
 

Attachments

Back
Top