Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Toppers wrote...
I don't think you can do it without code... .... Well not if there could be more than a few dozen items to concatenate, but if there were fewer items, no code required. "sebastian stephenson" wrote: I have set of data Key Text 1 x 1 y 1 z 2 a 2 b 3 c 3 d Would this always be sorted by Key? I'll assume so, and I'll also assume the table above, excluding the top row of labels, is named Tbl. I want to use a function that will return Key Text 1 x,y,z 2 a,b 3 c,d .... If the result range were in D1:E4 with labels in D1:E1, try these formulas. D2: =INDEX(Tbl,1,1) E2: =INDEX(Tbl,1,2)&IF(COUNTIF(INDEX(Tbl,0,1),D2)1,", "&INDEX(Tbl,2,2),"") &IF(COUNTIF(INDEX(Tbl,0,1),D2)2,","&INDEX(Tbl,3,2 ),"") &IF(COUNTIF(INDEX(Tbl,0,1),D2)3,","&INDEX(Tbl,4,2 ),"") &IF(COUNTIF(INDEX(Tbl,0,1),D2)4,","&INDEX(Tbl,5,2 ),"") &IF(COUNTIF(INDEX(Tbl,0,1),D2)5,","&INDEX(Tbl,6,2 ),"") D3: =INDEX(Tbl,SUMPRODUCT(COUNTIF(INDEX(Tbl,0,1),D$2:D 2))+1,1) E3: =INDEX(Tbl,SUMPRODUCT(COUNTIF(INDEX(Tbl,0,1),D$2:D 2))+1,2) &IF(COUNTIF(INDEX(Tbl,0,1),D3)1, ","&INDEX(Tbl,SUMPRODUCT(COUNTIF(INDEX(Tbl,0,1),D$ 2:D2))+2,2),"") &IF(COUNTIF(INDEX(Tbl,0,1),D3)2, ","&INDEX(Tbl,SUMPRODUCT(COUNTIF(INDEX(Tbl,0,1),D$ 2:D2))+3,2),"") &IF(COUNTIF(INDEX(Tbl,0,1),D3)3, ","&INDEX(Tbl,SUMPRODUCT(COUNTIF(INDEX(Tbl,0,1),D$ 2:D2))+4,2),"") &IF(COUNTIF(INDEX(Tbl,0,1),D3)4, ","&INDEX(Tbl,SUMPRODUCT(COUNTIF(INDEX(Tbl,0,1),D$ 2:D2))+5,2),"") &IF(COUNTIF(INDEX(Tbl,0,1),D3)5, ","&INDEX(Tbl,SUMPRODUCT(COUNTIF(INDEX(Tbl,0,1),D$ 2:D2))+6,2),"") Fill D3:E3 down as far as needed. On the other hand, if one uses Laurent Longre's MOREFUNC.XLL add-in, the column E formulas could be reduced to E2 [array formula]: =MID(MCONCAT(IF(INDEX(Tbl,0,1)=D2,","&INDEX(Tbl,0, 2),"")),2,255) Fill E2 down as far as needed. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I get multiple matches when using the Vlookup function? | Excel Worksheet Functions | |||
Can I return multiple columns from a vlookup? | Excel Worksheet Functions | |||
VLOOKUP - Multiple cells in lookup value | Excel Worksheet Functions | |||
Row Sequencing | Excel Worksheet Functions | |||
VLOOKUP Function using multiple worksheets | Excel Discussion (Misc queries) |