Forum Discussion

bpnelms's avatar
bpnelms
Copper Contributor
Aug 17, 2022
Solved

Transpose or ??

This is probably a simple thing, but I haven't found anything that works.  It's similar to transpose, but not really.  So basically I need the table on the left of the screenshot converted into the table on the right.  The end result would have the category only listed once and the variations of that category shown to the right in columns.  I have a list of about 5k items so I was just looking for a speedy solution.  Thanks for any ideas!

 

 

  • bpnelms 

     

    I only loaded Option1 to the sheet. All others are Connections only. To load them to sheets:

    - Go to the Data tab > Queries & Connections (the corresponding pane opens)

    - Right-click on each where you see Connection only below its name > Load To... > Table > OK

  • Lorenzo's avatar
    Lorenzo
    Silver Contributor

    bpnelms 

    (EDITED: Added Option3 that's almost all done with the UI/Menus)

     

    With Power Query

    2 options in attached file. Option1_1 is a variation of Option1, in case you hit performance issue with the latter

     

    Option1:

     

     

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        GroupedRows = Table.Group(Source, {"Category"},
            {"DATA", each
                Table.FromRows(
                    { {Table.FirstValue(_)} & [Variation] }
                ),
                type table
            }
        ),
        CombinedTables = Table.Combine(GroupedRows[DATA])
    in
        CombinedTables

     

     

     

    • bpnelms's avatar
      bpnelms
      Copper Contributor
      Maybe I missed it, but I don't see the different options in the file. Thanks
      • Lorenzo's avatar
        Lorenzo
        Silver Contributor

        bpnelms 

         

        I only loaded Option1 to the sheet. All others are Connections only. To load them to sheets:

        - Go to the Data tab > Queries & Connections (the corresponding pane opens)

        - Right-click on each where you see Connection only below its name > Load To... > Table > OK

    • bpnelms's avatar
      bpnelms
      Copper Contributor

      Lorenzo   Thanks to everyone for the help with this.  I am going to experiment with several of the suggestions today.  I think this will resolve the issue.  I appreciate the suggestions and expertise!

  • EricJanson's avatar
    EricJanson
    Copper Contributor
    It looks like you're trying to "pivot" the data, as opposed to transpose it.
    That's a job for Power Query.
  • bpnelms 

    It depends on your Excel version / platform. Perhaps Power Query is preferable solution if you have few thousand rows of data. For Excel 365 dynamic arrays formulae could work, but that again depends on version.

     

    So, to be more concrete it's desirable to know on which excel you are.

    • bpnelms's avatar
      bpnelms
      Copper Contributor

      SergeiBaklan I am using a windows PC with Office 365. I’m somewhat familiar with Power Query but just didn’t know where to start. 

Resources