I would like to concatenate multiple related values into one cell

yashwanthkumar

New Member
Joined
Nov 21, 2019
Messages
2
Hi there,

I am trying to concatenate the related assignment numbers of students into one cell. The data in first 2 columns is what I have and I am trying to achieve the result as per third column. can some please assist me on how to do this?
there 1000 row items, each student will have different assignment numbers and can appear upto 10 times, what I need is all the assignment numbers belonging to a particular student to appear in a single cell with comma separators, is this doable?

NameAssignment NumbersWhat I need is
ABC22,3,4
ABC3
ABC4
BBC11,7
BBC7
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
If you have the TextJoin function, try
Book1
ABC
1NameAssignment NumbersWhat I need is
2ABC22,3,4
3ABC3 
4ABC4 
5BBC11,7
6BBC7 
Database
Cell Formulas
RangeFormula
C2:C6C2{=IF(COUNTIF(A$2:A2,A2)=1,TEXTJOIN(",",1,IF($A$2:$A$6=A2,$B$2:$B$6,"")),"")}
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
 
Upvote 0
I don't know what version of Excel you are using. I've used TEXTJOIN function:


A
B
C
1
NameAssignment NumbersWhat I need is
2
ABC
2​
2, 3, 4
3
ABC
3​
4
ABC
4​
5
BBC
1​
1, 7
6
BBC
7​



A
B
C
1
NameAssignment NumbersWhat I need is
2
ABC
2​
=IF(A2<>A1,TEXTJOIN(", ",1,IF($A$2:$A$20=A2,$B$2:$B$20,"")),"")

Formula in C2 is array type so you have to accept it with Ctrl+Shift+Enter (not just Enter as usual). You should spot that curly brackets {} appear around formula in formula bar.
Then drag it down as long as needed.
 
Upvote 0
Not sure which of us you're talking to, but glad we could help & thanks for the feedback
 
Upvote 0
Does not matter Fluff.
The most important part is the same in both solutions and both based on textjoin.
Happy to help.
 
Upvote 0
They will only give the same result if the data is sorted by Name, which it is in the op, otherwise the results are different.

Book1
ABCD
1NameAssignment NumbersFluffKokosek
2BBC11,71, 7
3ABC22,4,82, 4, 8
4ABC4  
5BBC7 1, 7
6ABC8 2, 4, 8
Database


But the OP is happy & that's all that counts. :)
 
Upvote 0
Sure, that's why I said 'the most important part'. Even in your table above all results are correct. Mine just showing CORRECT result for all appearances of particular Name, Yours only for first appearance. :p
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top