Search code examples
excel-formulatextjoin

Textjoin: Using a unique ID, how do I concat multiple values?


I'm having trouble getting this to work. Basically, I have the following set of data:

enter image description here

In the TextJoin Formula column, I want it to do a look up against the adjacent ID, scan the income code column and concat the income codes pertaining to that unique ID, separated by a ','.

enter image description here

Many thanks


Solution

  • use:

    =TEXTJOIN(",",TRUE,IF($A$2:$A$6=$A2,$B$2:$B$6,""))
    

    Depending on one's version this may require Ctrl-Shift-Enter instead of Enter when exiting edit mode.


    If one has the Dynamic Array Formula FILTER:

    =TEXTJOIN(",",,FILTER(B:B,A:A=A2))