Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This sample code at John Walkenbach's site will show how to get a unique
list using a collection. http://www.j-walk.com/ss/excel/tips/tip47.htm You can then wrap this approach in a loop that identies when the first column changes when you will then write you value frm the first column and build a concatenated string for the second column from the values in the collection - then clear the collection continue down the list -- Regards, Tom Ogilvy "italia" wrote in message ups.com... I have a spreadsheet with 2 columns and thousands of rows. The first column is the id Example of the data (2 columns)- 04731 CRM 04731 CRM 04731 CRM 04731 RVB 04731 RVB 25475 FRB 25475 FRB 25475 MMX 25475 MMX Result desired (2 columns)- 04731 CRM; RVB 25475 RVB; MMX Idea is to summarize the data and eliminate the duplicates I am using the folloeing Code but it does not provide the desired result- Sub Test1() Dim lastrow As Long Dim i As Long lastrow = Cells(Rows.Count, 1).End(xlUp).Row i = lastrow Do While i 1 If Cells(i, 1).Value = Cells(i - 1, 1).Value Then If Cells(i, 2).Value = Cells(i - 1, 2).Value Then Cells(i, 1).EntireRow.Delete Else Cells(i - 1, 2).Value = Cells(i - 1, 2).Value & "; " & _ Cells(i, 2).Value Cells(i, 1).EntireRow.Delete End If End If i = i - 1 Loop End Sub Any help is greatly appreciated. Thanks !!! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Filter duplicates based on criteria / column values | Excel Discussion (Misc queries) | |||
How to eliminate everything but duplicates | Excel Worksheet Functions | |||
concat rows | Excel Worksheet Functions | |||
Find Duplicates Rows Based Own Multiple Columns | Excel Discussion (Misc queries) | |||
Concat Variant Values | Excel Programming |