Search code examples
excelexcel-formulacountiftextjoinexcel-tables

TEXTJOIN of column with same values of other columns, Table references


On column D i want TEXTJOIN of column C.

  1. delimiter is comma with a space after: ", "
  2. the two conditions that have to be met are: same date in column A, same value in column B
  3. This is a table so I prefer using references of the name of the columns (for example "Date")

any help will be greatly appreciated

enter image description here


Solution

  • 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))))
    

    enter image description here