Google Sheets – Formula to Combine Text if Duplicate Numbers Exist

concatenateformulasgoogle sheetsgoogle-sheets-arrayformula

I have a table to combine text with conditions if in column A there is a duplicate number, then in the text in column B combined.
The formula that I have made like this:

=IF(COUNTIF($A:$A,A2)>1,TEXTJOIN(",",TRUE,B2:B),"")

But the results do not match, the results I want in column E.
enter image description here

Best Answer

  • paste in a cell on the first row:

=ARRAYFORMULA(IF(IF(LEN(A2:A), IF(((COUNTIF(A2:A, A2)<>
 COUNTIF(INDIRECT("$A$2:A"), A2:A))+(MATCH(A2:A, $A$2:$A, 0)<
 ROW(A2:A)-1))>1, TRUE, ), )=TRUE,
 {""; IF((COUNTIF($A$2:$A, $A$2:$A)>1), B2:B, )&
      IF((COUNTIF($A$2:$A, $A$2:$A)>1), B3:B, )}, ))