Reputation: 169
On column D i want TEXTJOIN of column C.
any help will be greatly appreciated
Upvotes: 1
Views: 1633
Reputation: 11483
=IF($B1<>$B2,IFERROR(TEXTJOIN(",",0,$C2:INDEX($C2:$C$12,MATCH(1,--($B2:$B$12<>$B2),0)-1)),TEXTJOIN(",",0,$C2:$C$12)),"")
The Formula indexes column C from the current row up until it finds a different value in column B (minus 1).
The IFERROR is for the last found in range, because it will not find a value in the range after that value that doesn't match that value anymore. To be entered with ctrl+shift+enter
for Excel versions prior to Office 365
Upvotes: 2
Reputation: 2195
You can use TEXTJOIN
in conjunction with FILTER
.
Something like: =TEXTJOIN(",",1, FILTER($C$2:$C$12, ($B$2:$B$12=B2)*($A$2:$A$12=A2))
Note you can replace the ranges with the named ranges, and that '*' is used as a sort of AND
within the FILTER
function.
EDIT: to avoid repeating rows, you can wrap the entire function with an IF
statement that checks for duplicates. Something like:
=IFERROR(IF(MATCH(
TEXTJOIN(",",1,FILTER($C$2:$C$12,($B$2:$B$12=$B12)*($A$2:$A$12=$A12))),D$1:D11,0)>0,""),
TEXTJOIN(",",1,FILTER($C$2:$C$12,($B$2:$B$12=$B12)*($A$2:$A$12=$A12))))
Upvotes: 1