Combining Text

cjwally4

New Member
Joined
Nov 24, 2009
Messages
13
How can I combine the text in col B into one row for the matching identifier in column A?
<table border="0" cellpadding="0" cellspacing="0" width="160"><col style="width:48pt" width="64"> <col style="mso-width-source:userset;mso-width-alt:3510;width:72pt" width="96"> <tbody><tr style="height:12.75pt" height="17"> <td style="height:12.75pt;width:48pt" height="17" width="64">COL A</td> <td style="width:72pt" width="96">COL B</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>
</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">S123</td> <td>Hello</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">S123</td> <td>my name</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">S123</td> <td>is john</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">S123</td> <td>how</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">S123</td> <td>are you</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">S123</td> <td>this</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">S123</td> <td>fine day</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">S465</td> <td>Hello</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">S465</td> <td>my name</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">S465</td> <td>is john</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">S465</td> <td>how</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">S465</td> <td>are you</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">S465</td> <td>this</td> </tr> </tbody></table>
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
I am extracting comments associated with an order number from a TCL database. The format that extracts lists the order in column A and the comments in column B. The TCL format is multivalued meaning they can't be extracted in a single string. It looks as follows:

Order#1 Comment
Comment
Order#2 Comment
Comment
Comment

Etc. It's 1200 lines and the number of comments per order can bu up to 10. My first step is to fill in the blanks with the order number so each comment has a reference to the correct order number. What I want to do is take the comment string and put it all into one row:

Order#1 Comment, Comment
Order#2 Comment, Comment, Comment

Does that help?

THanks very much
First off, don't fill in the blanks... the VB code works better if you don't.:wink:

Code:
Sub ConcatenateCommentsPerOrderNumber()
  Dim LastRow As Long, Blank As Range, CommentRange As Range
  Const DataStartRow As Long = 2
  LastRow = Cells(Rows.Count, "B").End(xlUp).Row
  With Cells(DataStartRow, "A").Resize(LastRow - DataStartRow + 1)
    For Each Blank In .SpecialCells(xlCellTypeBlanks).Areas
      Blank(1).Offset(-1, 1).Value = Join(WorksheetFunction.Transpose(Blank(1).Offset(-1, 1).Resize(Blank.Count + 1)), ", ")
    Next
    .SpecialCells(xlCellTypeBlanks).EntireRow.Delete
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,540
Messages
6,179,417
Members
452,912
Latest member
alicemil

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