Results 1 to 8 of 8

Thread: Transpose 2 column [Key, values] list to mulit column [unique Key, Value1, value2, value3, ......] list

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Member p45cal's Avatar
    Join Date
    Oct 2013
    Posts
    94
    Rep Power
    13
    Quote Originally Posted by sandy666 View Post
    you can try Power Query (excel 2016 and up)simple version:
    Doesn't this assume a max of 4 repeated codes?
    I was waiting for the OP to come back before posting.
    I did a PQ offering. A bit convoluted (I'm sure you can streamline it):
    The query:
    Code:
    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Grouped Rows" = Table.Group(Source, {"Code"}, {{"grp", each _, type table [Code=number, Values=number]}}),
        #"Invoked Custom Function" = Table.Combine(Table.AddColumn(#"Grouped Rows", "fnTranspose2", each fnTranspose2([grp]))[fnTranspose2])
    in
        #"Invoked Custom Function"
    The called function named fnTranspose2:
    Code:
    (tbl)=> [AddIndx = Table.AddIndexColumn(tbl, "Index", 1, 1, Int64.Type),
        AddPrefix = Table.TransformColumns(AddIndx, {{"Index", each "Value" & Text.From(_), type text}}),
        TakeColms = Table.ReorderColumns(AddPrefix,{"Index", "Code", "Values"}),
        Result = Table.Pivot(TakeColms, List.Distinct(TakeColms[Index]), "Index", "Values", List.Sum)][Result]
    Also a formula approach:
    In one cell (eg. cell F8):
    =UNIQUE(Table1[Code])
    In the cell to the right:
    =TRANSPOSE(FILTER(Table1[Values],Table1[Code]=F8))
    copied down as far as necessary. F8 is the address of that cell to the right.
    Last edited by p45cal; 08-03-2022 at 01:33 AM.

  2. #2
    Junior Member
    Join Date
    Oct 2021
    Posts
    3
    Rep Power
    0
    it works. Let me try for more data.
    Thanks

Similar Threads

  1. Replies: 23
    Last Post: 07-27-2014, 06:06 PM
  2. Replies: 10
    Last Post: 05-23-2013, 12:30 PM
  3. Numbered List Of Unique Values
    By xander1981 in forum Excel Help
    Replies: 6
    Last Post: 01-21-2013, 06:10 PM
  4. shortcut key to list of macros
    By Rasm in forum Excel Help
    Replies: 4
    Last Post: 01-10-2013, 03:19 PM
  5. Replies: 2
    Last Post: 01-07-2012, 12:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •