ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Compare identifier columns from 2 sheets - remove rows that are dups (https://www.excelbanter.com/excel-worksheet-functions/445975-compare-identifier-columns-2-sheets-remove-rows-dups.html)

Livin

Compare identifier columns from 2 sheets - remove rows that are dups
 
I have two sheets with thousands of rows. I need to remove rows from the 2nd
sheet that have the same identifier as rows in the first sheet... so there are
no duplicates.

Example...

'Sheet1'

ddd1234 <several data columns
ddd1234 <several data columns
abc1234 <several data columns
wrd1234 <several data columns
wrd1234 <several data columns



'Sheet2'

ddd1234 <several data columns
abc1234 <several data columns
wrd1234 <several data columns
www1234 <several data columns
ggg1234 <several data columns


.... yes, Sheet1 may have multiple rows with the same identifier but that does
not matter... I just want to remove rows from Sheet2 anything that matches IDs
from Sheet1 - I don't care about consolidating or removing dups from Sheet1.

thx for the help!

Livin

Compare identifier columns from 2 sheets - remove rows that are dups
 
I need this to be a Macro (VBA)... thx!

isabelle

Compare identifier columns from 2 sheets - remove rows that aredups
 
hi Livin,

Sub test()
With Sheets("Sheet2")
For i = .Range("A65536").End(xlUp).Row To 1 Step -1
If Not IsError(Application.Match(.Range("A" & i), Sheets("Sheet1").Range("A:A"), 0)) Then
.Rows(i).Delete Shift:=xlUp
End If
Next
End With
End Sub

--
isabelle



Le 2012-05-04 19:35, Livin a écrit :
I have two sheets with thousands of rows. I need to remove rows from the 2nd
sheet that have the same identifier as rows in the first sheet... so there are
no duplicates.

Example...

'Sheet1'

ddd1234<several data columns
ddd1234<several data columns
abc1234<several data columns
wrd1234<several data columns
wrd1234<several data columns



'Sheet2'

ddd1234<several data columns
abc1234<several data columns
wrd1234<several data columns
www1234<several data columns
ggg1234<several data columns


... yes, Sheet1 may have multiple rows with the same identifier but that does
not matter... I just want to remove rows from Sheet2 anything that matches IDs
from Sheet1 - I don't care about consolidating or removing dups from Sheet1.

thx for the help!



All times are GMT +1. The time now is 11:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com