Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Compare columns for dupes

Hi all,

This is probably something very simple. I have two columns that I need to
compare for duplicates. So I have columns A and B, I need a macro that will
compare the data in column A with the data in column B then copy any
duplicates to column C.

Can someone provide some code?

Thanks.

-B


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Compare columns for dupes

in C1

=if(countif(A:A,B1)0,B1,"")

then drag fill down the column.

--
Regards,
Tom Ogilvy


"Martin" wrote:

Hi all,

This is probably something very simple. I have two columns that I need to
compare for duplicates. So I have columns A and B, I need a macro that will
compare the data in column A with the data in column B then copy any
duplicates to column C.

Can someone provide some code?

Thanks.

-B



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Compare columns for dupes

Thanks I found this code on Microsoft's website and it seems to work,
however, I'd like to add a regex procedure that would match wildcards, etc.

If someone can provide an example, I would appreciate it.

Sub Find_Matches()

Dim CompareRange As Variant, x As Variant, y As Variant

Set CompareRange = Range("C1:C5")

For Each x In Selection
For Each y In CompareRange
If x = y Then x.Offset(0, 1) = x
Next y
Next x

End Sub

-B

"Tom Ogilvy" wrote in message
...
in C1

=if(countif(A:A,B1)0,B1,"")

then drag fill down the column.

--
Regards,
Tom Ogilvy


"Martin" wrote:

Hi all,

This is probably something very simple. I have two columns that I need to
compare for duplicates. So I have columns A and B, I need a macro that
will
compare the data in column A with the data in column B then copy any
duplicates to column C.

Can someone provide some code?

Thanks.

-B





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Compare columns for dupes

Search Google groups for regex and group *excel*

--
regards,
Tom Ogilvy

"Martin" wrote in message
...
Thanks I found this code on Microsoft's website and it seems to work,
however, I'd like to add a regex procedure that would match wildcards,
etc.

If someone can provide an example, I would appreciate it.

Sub Find_Matches()

Dim CompareRange As Variant, x As Variant, y As Variant

Set CompareRange = Range("C1:C5")

For Each x In Selection
For Each y In CompareRange
If x = y Then x.Offset(0, 1) = x
Next y
Next x

End Sub

-B

"Tom Ogilvy" wrote in message
...
in C1

=if(countif(A:A,B1)0,B1,"")

then drag fill down the column.

--
Regards,
Tom Ogilvy


"Martin" wrote:

Hi all,

This is probably something very simple. I have two columns that I need to
compare for duplicates. So I have columns A and B, I need a macro that
will
compare the data in column A with the data in column B then copy any
duplicates to column C.

Can someone provide some code?

Thanks.

-B







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
macro for dupes shaji Excel Discussion (Misc queries) 2 June 17th 08 04:51 PM
Compare two arrays in VBA to find dupes John Michl Excel Programming 2 February 6th 07 05:34 PM
Checking for Dupes TKnTexas Excel Discussion (Misc queries) 4 November 3rd 06 02:43 AM
Marking Dupes GregR Excel Programming 7 January 10th 06 02:17 AM
How can I compare 2 sets of Social Security #'s and Identify dupes vwwolfe Excel Discussion (Misc queries) 1 February 3rd 05 10:08 PM


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

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

About Us

"It's about Microsoft Excel"