Here's a formulas play which seems to be able to drive out the desired
results as well (Link to a sample file is provided below)
In Sheet1:
Source data is assumed in A2:B7 in Sheet1
Put in C2: =IF(A2="","",IF(COUNTIF($A$2:A2,A2)>1,"",ROW()))
Copy down to say, C10
Put in D1:
=IF(ISERROR(SMALL($C:$C,COLUMNS($A$1:A1))),"",TRANSPOSE(INDEX($A:$A,MATCH(SM
ALL($C:$C,COLUMNS($A$1:A1)),$C:$C,0))))
Copy across to say, H1
In D1:H1 will be extracted the unique items in col A, i.e.: AA, BB, CC
Put in D2: =IF(D$1="","",IF($A2=D$1,ROW(),""))
Copy across to H2, fill down to H10 to populate the grid
In Sheet2:
Put in A2: =OFFSET(Sheet1!$C$1,,ROWS($A$1:A1))
Copy down to A6
(I.e. by as many rows as the # of cols in D1:H1 in Sheet1)
This transposes the list of unique items from D1:H1 in Sheet1 into A2:A6
Put in B2:
=IF(ISERROR(SMALL(OFFSET(Sheet1!$C$2:$C$10,0,MATCH($A2,Sheet1!$C$1:$H$1,0)-1
),COLUMNS($A$1:A1))),"",TRANSPOSE(INDEX(Sheet1!$B$2:$B$10,MATCH(SMALL(OFFSET
(Sheet1!$C$2:$C$10,0,MATCH($A2,Sheet1!$C$1:$H$1,0)-1),COLUMNS($A$1:A1)),OFFS
ET(Sheet1!$C$2:$C$10,0,MATCH($A2,Sheet1!$C$1:$H$1,0)-1),0),)))
Copy B2 across to say, G2, fill down to G6
[copy across as many cols as there are items per unique to be extracted,
i.e. Apple, Pear, etc]
In A2:G6 will be returned the desired results
Sample file with the implemented construct:
http://flypicture.com/p.cfm?id=62362
(Right-click on the link: "Download File"
at the top in the page, just above the ads)
File: bmac184_wksht_1.xls