combine almost identical rows into one by concatenating unique values

teresadg

New Member
Joined
Aug 29, 2011
Messages
2
Hi,

I hope someone could help me with sorting this table out thru vba:

Item#
Desc1 Desc2...
Descx (columns can run longer)
C1 red long thin
C2 blue short
thick
C3 red long thin
C4 blue short thick
C5 yellow med med
Cy blue short thick

<colgroup><col style="width:48pt" width="64" span="4"> </colgroup><tbody>
</tbody>

(rows can run longer)

Resulting table should be:

Item# Desc1 Desc2... Descx
C1, C3red long thin
C2, C4, Cyblue short thick
C5 yellow med med

<colgroup><col style="mso-width-source:userset;mso-width-alt:3986;width:82pt" width="109"> <col style="width:48pt" width="64" span="2"> <col style="mso-width-source:userset;mso-width-alt:3437;width:71pt" width="94"> </colgroup><tbody>
</tbody>
Basically, rows with the same content from column 2 to x, is combined and the first cell in such rows is concatenated (separated by comma).

Thanks for taking the time out to help.

Regards
teresadg

<colgroup><col style="mso-width-source:userset;mso-width-alt:3291;width:68pt" width="90"> <col style="width:48pt" width="64" span="2"> <col style="mso-width-source:userset;mso-width-alt:3437;width:71pt" width="94"> </colgroup><tbody>
</tbody>

<colgroup><col style="mso-width-source:userset;mso-width-alt:2413;width:50pt" width="66"> <col style="width:48pt" width="64" span="2"> <col style="mso-width-source:userset;mso-width-alt:3437;width:71pt" width="94"> </colgroup><tbody>
</tbody>

<colgroup><col style="width:48pt" width="64" span="3"> <col style="mso-width-source:userset;mso-width-alt:3437;width:71pt" width="94"> </colgroup><tbody>
</tbody>
 
Last edited:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

teresadg

New Member
Joined
Aug 29, 2011
Messages
2
Re-posting the desired outcome (sorry for the earlier post)...
Item# Desc1 Desc2... Descx
C1, C3red long thin
C2, C4, Cyblue short thick
C5 yellow med med

<colgroup><col style="mso-width-source:userset;mso-width-alt:3986;width:82pt" width="109"> <col style="width:48pt" width="64" span="2"> <col style="mso-width-source:userset;mso-width-alt:3437;width:71pt" width="94"> </colgroup><tbody>
</tbody>

Basically, rows with the same content from column 2 to x, is combined and the first cell in such rows is concatenated (separated by comma).

Thanks for taking the time out to help.

teresadg
 
Upvote 0

Forum statistics

Threads
1,195,952
Messages
6,012,509
Members
441,703
Latest member
clivelincoln

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
Top