PC Review


Reply
Thread Tools Rate Thread

Compare columns for dupes

 
 
Martin
Guest
Posts: n/a
 
      14th Mar 2007
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 With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      14th Mar 2007
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 With Quote
 
Martin
Guest
Posts: n/a
 
      15th Mar 2007
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" <(E-Mail Removed)> wrote in message
news:CC188BFA-E03A-4580-967F-(E-Mail Removed)...
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 With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      16th Mar 2007
Search Google groups for regex and group *excel*

--
regards,
Tom Ogilvy

"Martin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:CC188BFA-E03A-4580-967F-(E-Mail Removed)...
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare two columns pm Microsoft Excel Misc 7 3rd Jul 2008 09:59 PM
Compare two arrays in VBA to find dupes John Michl Microsoft Excel Programming 2 6th Feb 2007 05:34 PM
Compare Two Columns Michael Laferriere Microsoft Excel Worksheet Functions 5 3rd Feb 2007 09:01 PM
Narly one...compare columns with other columns beatrice25 Microsoft Excel Misc 7 4th Jun 2006 09:43 PM
How can I compare 2 sets of Social Security #'s and Identify dupes =?Utf-8?B?dnd3b2xmZQ==?= Microsoft Excel Misc 1 3rd Feb 2005 10:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:34 PM.