How do I compare 2 lists and show duplicates as a new list? PLEASEEEE

estezz

New Member
Joined
Jul 21, 2011
Messages
12
I have 2 lists of several part numbers, text and price { each row has 3 cells}. I need to compare both lists and extract all the duplicate ROWS, copy them and place them in a new list.
Does anyone have a macro that can do this task that they are willing to share?

Please help me, for advice on how to create macros and I'll be grateful, i need help TODAY :(
Maria from Czech republic :-*
estezz@seznam.cz
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Is anything on column D?
What version of XL do you use?

Assuming u have ur part numbers in columnsA,B,C in Sheet1 and Sheet2
Algorithm#1:
Sort by C, then B, then A in both lists
Check A, then B, then C
Copy duplicates onto new list

Algorithm#2:
Concatentate A,B,C in both lists
Check each element from both lists
Copy duplicates onto new list


And it might be a good idea to erase your email or put it in a different format because if you don't, you will get tons of spam mails.
 
Upvote 0
i have XL 2007
colum d is empty

please help me with it
Maria

for example

sheet one
A B C
1 158 martin 20/07/2010
2 178 martin 20/07/2010
3 148 pavel 20/07/2010
4 199 jan 20/07/2010
5 148 martin 20/07/2010
6 718 martin 20/07/2010
...... about 10000 rows

sheet two
1 108 mdartin 20/07/2010
2 198 martin 20/07/2010
3 1778 sad 20/07/2010
4 199 jan 20/07/2010
5 148 martin 20/07/2010
6 718 martin 20/07/2010
about 100 rows

and i need duplicates on the new sheet 3

can you help me?
 
Upvote 0
If both lists have the same headers, you could use Advanced Filter with one of the lists as the ListRange, the other list as the CriteriaRange and the CopyTo range of your choice.
 
Upvote 0
but appear to list three if the same cell line on the sheet 1 and second .. same number, same name, same date

I am beginner in Excel, I do not understand, I need more detailed directions
 
Upvote 0
If both lists have the same headers, you could use Advanced Filter with one of the lists as the ListRange, the other list as the CriteriaRange and the CopyTo range of your choice.

Oh... Right lol. there's an easier one...
Oh well.. I already made the code;;; so try
Code:
Sub kpark91July21()
    Dim LR1&, LR2&, count&, dataWS1 As Worksheet, dataWS2 As Worksheet, i&, j&, destWS As Worksheet
    Set dataWS1 = ThisWorkbook.Worksheets("Sheet 1")
    Set dataWS2 = ThisWorkbook.Worksheets("Sheet 2")
    Set destWS = ThisWorkbook.Worksheets("Sheet 3")
    LR1 = dataWS1.Range("A" & Rows.count).End(xlUp).Row
    LR2 = dataWS2.Range("A" & Rows.count).End(xlUp).Row
    concatenateABC dataWS1, LR1, dataWS2, LR2
    count = 1
    
    For j = 1 To LR2
        For i = 1 To LR1
            If dataWS2.Range("D" & j).Value = dataWS1.Range("D" & i).Value Then
                dataWS2.Range("A" & j & ":C" & j).Copy destWS.Range("A" & count)
                count = count + 1
            End If
        Next i
    Next j
End Sub
Function concatenateABC(dataWS1 As Worksheet, LR1 As Long, dataWS2 As Worksheet, LR2 As Long)
    Dim i&
    For i = 1 To LR1
        dataWS1.Range("D" & i).Value = dataWS1.Range("A" & i).Value _
                                        & dataWS1.Range("B" & i).Value _
                                        & dataWS1.Range("C" & i).Value
    Next i
    For i = 1 To LR2
        dataWS2.Range("D" & i).Value = dataWS2.Range("A" & i).Value _
                                        & dataWS2.Range("B" & i).Value _
                                        & dataWS2.Range("C" & i).Value
    Next i
End Function
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,733
Members
452,939
Latest member
WCrawford

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