Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default **finding duplicates from multiple columns and highlighting**

I have a list consisting of 2 columns that a duplicate may appear in 1 column
but if the second column has a different value it is still unique. I wish to
check this list against a second master list (containing all the info) and
find the duplicates in the first list and copy these duplicates to a second
sheet in the same document. Lists contain both numbers and letters. List is
over 10,000 rows so need to have no manual part to this.

Thanks

Kyle
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default **finding duplicates from multiple columns and highlighting**


I do this all the time. I like using a formula on the worksheet using
SumProdcut to find the duplicates. The use autofilter to to get just
the duplicates. then using specialcell method copy only the visible
cells to a new sheet.

Sub CopyDuplicates()

Set Sourcesht = Sheets("sheet1")
Set DestSht = Sheets("sheet3")
Set MasterSht = Sheets("Master")

With MasterSht
MasterRows = .Range("A" & Rows.Count).End(xlUp).Row
End With


With Sourcesht
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
'create formula that will put an X in column IV if a duplicate
occurs
Range("IV1").Formula = _
"=if(Sumproduct(--(A1=" & MasterSht.Name & "!A$1:A$" & MasterRows
& ")," & _
"--(B1=" & MasterSht.Name & "!B$1:B$" & MasterRows &
"))0,true,false)"
'copy formula down column
Range("IV1").Copy _
Destination:=.Range("IV1:IV" & LastRow)

'use autofilter to find the duplicates indicated by true
Columns("IV:IV").AutoFilter
Columns("IV:IV").AutoFilter Field:=1, Criteria1:="TRUE"

'use special cells to find visible cells
Rows("2:" & LastRow).SpecialCells(xlCellTypeVisible).Copy _
Destination:=DestSht.Rows(1)
End With

End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=158441

Microsoft Office Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default **finding duplicates from multiple columns and highlighting**

Sub CheckingForDuplicates()

'i have done it for 5 rows only. Change it to 10000

'assuming your lists are in Columns A & B and starting in the first row

Cells(1, 3).FormulaR1C1 = "=rc[-2]&rc[-1]"
Cells(1, 4) = 1
Cells(2, 4).FormulaR1C1 = "=r[-1]c+1"
Cells(1, 3).Copy Range("c2:C5")
Cells(2, 4).Copy Range("d3:d5")
Range("c1:c5").Value = Range("c1:c5").Value
With Sheets(1).Sort
..SetRange Range("c1:c5")
..Apply
End With

'this section lists the duplicates in sheet 2

Dim Rows As Integer
Dim SheetsTwoRows As Integer
SheetsTwoRows = 1
For Rows = 2 To 5
If Cells(Rows + 1, 3).Value = Cells(Rows, 3) Then
Sheets(2).Cells(SheetsTwoRows, 1) = Cells(Rows, 3)
Sheets(2).Cells(SheetsTwoRows, 2) = Cells(Rows, 4)
SheetsTwoRows = SheetsTwoRows + 1
End If
Next

End Sub


"kyle.macdonald" wrote:

I have a list consisting of 2 columns that a duplicate may appear in 1 column
but if the second column has a different value it is still unique. I wish to
check this list against a second master list (containing all the info) and
find the duplicates in the first list and copy these duplicates to a second
sheet in the same document. Lists contain both numbers and letters. List is
over 10,000 rows so need to have no manual part to this.

Thanks

Kyle

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding Duplicates in Multiple Columns Kaylen Excel Discussion (Misc queries) 2 July 9th 09 08:13 PM
Finding and highlighting duplicates across multiple worksheets Vijay Excel Programming 4 July 6th 08 04:23 PM
Find Duplicates Rows Based Own Multiple Columns Cue Excel Discussion (Misc queries) 2 June 20th 08 11:43 PM
Finding duplicates in Multiple Columns JCS Excel Discussion (Misc queries) 16 May 13th 08 02:02 PM
Finding duplicates based on 2 columns [email protected] Excel Worksheet Functions 5 March 27th 07 10:31 PM


All times are GMT +1. The time now is 11:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"