+ Reply to Thread
Results 1 to 3 of 3

Group value in columns with header based on value in another column

  1. #1
    Registered User
    Join Date
    07-10-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    13

    Cool Group value in columns with header based on value in another column

    Hi all,

    Could you please help me with this case:

    I have Group name in one column and Item name in other column. Each item belongs to respective group in the on the left cell.

    We want to have Group name as Column header and all items belong to the group in the column.

    zzh8.jpg
    [IMG]img5.imageshack.us/img5/1214/zzh8.jpg[/IMG]

    I tried transpose paste, pivot table but it didn't work.
    Since I have more than 3000 items belong to 200 different groups, I would not prefer to do manual copy and paste.

    Thank you very much for your help.

  2. #2
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520

    Re: Group value in columns with header based on value in another column

    Here's one way which delivers it ...
    This illustration assumes your data as per your jpg is in cols A and B, in row2 down
    Put in C2: =IF(A2="","",IF(COUNTIF(A$2:A2,A2)>1,"",ROW()))
    Copy C2 down all the way
    Put in D1: =IF(COLUMNS($A:A)>COUNT($C:$C),"",INDEX($A:$A,SMALL($C:$C,COLUMNS($A:A))))
    Copy across to E1 (this draws out the unique groups in col A in a horizontal, row-wise manner, all neatly packed to the left)
    Put in D2: =IF($A2=D$1,ROW(),"")
    Copy across to E2, fill down all the way

    Now to draw out the desired end results in adjacent cols to the right ...
    Put in G1: =D1, copy across to H1
    Put in G2: =IF(ROWS($1:1)>COUNT(D:D),"",INDEX($B:$B,SMALL(D:D,ROWS($1:1))))
    Copy across to H2, fill down all the way to extract the desired results, all neatly packed at the top
    ---------------------------------
    Success? Celebrate it, click the little star at the bottom right of my responses
    Last edited by Max, Singapore; 08-02-2013 at 04:36 AM.

  3. #3
    Registered User
    Join Date
    07-10-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Group value in columns with header based on value in another column

    Reputation added. It works, thanks a lot.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Sort multiple columns based on column header
    By Langer101 in forum Excel Programming / VBA / Macros
    Replies: 39
    Last Post: 01-09-2013, 09:55 AM
  2. Replies: 2
    Last Post: 10-13-2012, 03:30 AM
  3. add group header to QODBC based data
    By hvanderwielen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-15-2012, 04:01 PM
  4. Hiding a group of columns based on another column
    By fasterthanyours in forum Excel General
    Replies: 1
    Last Post: 01-13-2010, 04:17 PM
  5. Macro to rearrange/add columns based on column header?
    By drdavidge in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2006, 09:35 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1