Search code examples
arraysgoogle-sheetsconcatenationflattentextjoin

Concatinate all matching names dynamically | Google sheets


I want to get the concatenation of the input names according to value like this Name1, Name2,...

I tryed this formula but i need to be dynamic with Arrayformula.
Make a copy of this example

=IF(D3="",,TEXTJOIN(", ",1,FILTER($A$3:$A,$B$3:$B=D3)))

enter image description here


Solution

  • all you need is:

    =ARRAYFORMULA(REGEXREPLACE(TRIM(SPLIT(FLATTEN(QUERY(QUERY(
     FILTER({A3:A&",", B3:B&"×"}, B3:B<>""), 
     "select max(Col1) group by Col1 pivot Col2"),,9^9)), "×")), ",$", ))
    

    enter image description here