I have a data set that looks something like this-
Item | Value |
---|---|
A | 1 |
A | 2 |
A | 3 |
B | 1 |
B | 2 |
B | 3 |
C | 1 |
C | 2 |
And I want to convert it to this -
Item | Value |
---|---|
A | 1,2,3 |
B | 1,2,3 |
C | 1,2 |
CodePudding user response:
Using your provided example data, and assuming a data setup like this:
- In cell D2 and copied down is this formula to get unique items:
=INDEX($A$2:$A$9,MATCH(0,COUNTIF(D$1:D1,$A$2:$A$9),0))
- In cell E2 and copied down is this formula to get the joined values:
=TEXTJOIN(",",TRUE,REPT($B$2:$B$9,$A$2:$A$9=D2))
Adjust the ranges to suit your actual data.