How to Concatenate Multiple Rows with Conditions?

SiddharthB

New Member
Joined
Jun 11, 2018
Messages
1
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]Code No.[/TD]
[TD]Sr. No[/TD]
[TD]Customer[/TD]
[TD]Description[/TD]
[TD]List[/TD]
[TD]IF (code)[/TD]
[TD]IF (sr. no)[/TD]
[TD]sum[/TD]
[TD][/TD]
[TD]Textjoin (Description)[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]1[/TD]
[TD]ABC[/TD]
[TD]sentence[/TD]
[TD]x[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2[/TD]
[TD]EFH[/TD]
[TD]sentence[/TD]
[TD]x[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD]sentence[/TD]
[TD]x[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]3[/TD]
[TD]PQR[/TD]
[TD]sentence[/TD]
[TD]x[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[TD]sentence[/TD]
[TD]x[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[TD]sentence[/TD]
[TD]x[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]4[/TD]
[TD]SYZ[/TD]
[TD]sentence[/TD]
[TD]x[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]x[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]5[/TD]
[TD]LMO[/TD]
[TD]sentence[/TD]
[TD]x[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]5[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I need to concatenate (with a line break) the multiple rows (in description column) for each customer having a serial no. so that in the Textjoin colum, there is only one row for each customer and that row has all the sentences (with a line break) in the description column pertaining to each customer.

Is this possible? Help! Thank you
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi & welcome to the board.
How about
Code:
Sub ConcatDel()
   Dim Rng As Range
   
   For Each Rng In Range("C:C").SpecialCells(xlBlanks).Areas
      Rng.Offset(-1, 7).Resize(1, 1).Value = Join(Application.Transpose(Rng.Offset(-1, 1).Resize(Rng.Count + 1)), Chr(10))
   Next Rng
   Range("C:C").SpecialCells(xlBlanks).EntireRow.Delete
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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