Merge data when duplicate are found in first cell

chiller

New Member
Joined
May 4, 2005
Messages
18
Hi guys

stuck with this, Basically i have a excell sheet with these values in only first 3 columns shown( actual table has 33 headers)

itemNumberGrouped or simpleassociated products
100.010UK _GroupGrouped100.010UK
100.012UK _GroupGrouped100.012UK
100.031UK _GroupGrouped100.031AU
100.031UK _GroupGrouped100.031UK
100.331UK _GroupGrouped100.331UK
100.331UK _GroupGrouped100.332UK
100.331UK _GroupGrouped100.351UK
100.331UK _GroupGrouped100.352UK
100.360UK _GroupGrouped100.360UK
100.360UK _GroupGrouped100.361UK
100.363UK _GroupGrouped100.363UK
100.363UK _GroupGrouped100.364UK

<tbody>
</tbody>

I want the values in first column to be merged with identical values, and for the values in associated products to be merged in same cell with a (, ) as a delimiter.please see example 2nd table below .




2nd table
itemNumberGrouped or simplegrouped
100.010UK _GroupGrouped100.010UK,
100.012UK _GroupGrouped100.012UK,
100.031UK _GroupGrouped100.031AU,100.031UK,
100.331UK _GroupGrouped100.331UK,100.332UK,100.351UK,100.351UK
100.360UK _GroupGrouped100.360UK,100.361UK,
100.363UK _GroupGrouped100.363UK,100.364UK,

<tbody>
</tbody>


then i need to strip all rows that have less than 2 sku in ("grouped" 2nd table)
so end table look like this

itemNumberGrouped or simplegrouped
100.031UK _GroupGrouped100.031AU,100.031UK,
100.331UK _GroupGrouped100.331UK,100.332UK,100.351UK,100.351UK,
100.360UK _GroupGrouped100.360UK,100.361UK,
100.363UK _GroupGrouped100.363UK,100.364UK,

<tbody>
</tbody>



Hope you can help.
Munir
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
This assumes that the file has been previously sorted so that duplicates are adjacent to each other vertically in column A. Since data deleted by code cannot be undone with the Excel undo facility, you are advised to test this on a copy or a mock up of your file before applying it to the original.
Code:
Sub grouper()
Dim sh As Worksheet, lr As Long
Set sh = Sheets(1) 'Edit sheet name
lr = sh.Cells(Rows.Count, 1).End(xlUp).Row
    For i = lr To 3 Step -1
        With sh
            If .Cells(i, 1) = .Cells(i - 1, 1) Then
                .Cells(i - 1, 3) = .Cells(i - 1, 3).Value & "," & .Cells(i, 3).Value
                Rows(i).Delete
            End If
        End With
    Next
    For j = sh.Cells(Rows.Count, 3).End(xlUp).Row To 2 Step -1
        If InStr(sh.Cells(j, 3).Value, ",") = 0 Then sh.Rows(j).Delete
    Next
End Sub
 
Upvote 0
This works Perfectly, please excuse my delay in Gratitude.......

a)would it be possible to do a few tweaks to the file for example i would like to add the following extra rows with column header to every row.



also would it be possible to run this macro in Notepad++, because excell meeses up my formatting.



brief_desc_1_header brief_desc_2_headerbrief_desc_3_header
DescriptionPackedPack Qty
DescriptionPackedPack Qty

<tbody>
</tbody>


b)also would it be possible to run this macro in Notepad++, because excel messes up my formatting.

c)would like the following values to be changed

in the (further_infomation) |eol| to be changed to 2-way speakers
notice the different opening and closers

this will allow the data in this column to be shown with bullet marks.

further_infomationfurther_infomation
2-way speakers|eol|Magnetically shielded|eol|10cm (4") paper cone woofer with foam rubber surround|eol|5cm (2") paper cone tweeter with polycarbonate dome|eol|Mounting brackets supplied|eol|Spring clip terminal connections|eol|Supplied in pairs|eol|Available in black or white2-way speakers
Magnetically shielded
10cm (4") paper cone woofer with foam rubber surround
5cm (2") paper cone tweeter with polycarbonate dome
Mounting brackets supplied
Spring clip terminal connections
Supplied in pairs
Available in black or white


<tbody>
</tbody>

<tbody>
</tbody>

and change |tab| to

auto_technical_infoauto_technical_info
Power max.|tab|50W|eol|Frequency response|tab|65Hz - 20kHz|eol|Impedance|tab|6/8 Ohms|eol|Dimensions|tab|175 x 105 x 105mm|eol|Weight : Per set|tab|1.7kgPower max. 100W
Frequency response 200Hz - 15kHz
Impedance 8 ohms
SPL @ 1W/1m 85dB
System 2-way
Dimensions 205 x 102 x 100mm
Weight : Per set 2.5kg

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,827
Members
449,190
Latest member
rscraig11

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