Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Finding Unique Entries Among Two Columns

Columns A & B contain several thousand Project Numbers (e.g., P1052, PA844,
P6721.6, etc.). Column A has the latest list of Project Numbers. Column B
has an older list of Project Numbers. As such, column B is a subset of
column A. I need to find all of the €œnew€ (i.e., unique) Project Numbers
that exist in column A relative to column B, and put the results in column C.
Please note that row 1 is used for column headings, so the data contained in
columns A and B start in row 2.

I would appreciate any help in writing a macro that compares the Project
Numbers in columns A and B and outputs the unique Project Numbers to column C
(starting in row 2). The macro would know to stop when it encounters the
last Project Number in column A (FYI - there are blank cells after the last
Project Number in column A, which obviously is the longest of the two
columns).

Thanks for the help.
Bob

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Finding Unique Entries Among Two Columns

Did the code I supplied last time not work or did you need some kind of
modification of it...
--
HTH...

Jim Thomlinson


"Bob" wrote:

Columns A & B contain several thousand Project Numbers (e.g., P1052, PA844,
P6721.6, etc.). Column A has the latest list of Project Numbers. Column B
has an older list of Project Numbers. As such, column B is a subset of
column A. I need to find all of the €œnew€ (i.e., unique) Project Numbers
that exist in column A relative to column B, and put the results in column C.
Please note that row 1 is used for column headings, so the data contained in
columns A and B start in row 2.

I would appreciate any help in writing a macro that compares the Project
Numbers in columns A and B and outputs the unique Project Numbers to column C
(starting in row 2). The macro would know to stop when it encounters the
last Project Number in column A (FYI - there are blank cells after the last
Project Number in column A, which obviously is the longest of the two
columns).

Thanks for the help.
Bob

  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Finding Unique Entries Among Two Columns

Jim,
I was hoping you would write back. Unfortunately, when I go to Excel's
Tools | Macro | Macros... menu, I could not run your macro because nothing
was displayed in the list. Being a novice VBA programmer, am I missing a
step?
Thanks again for your help.
Bob

"Jim Thomlinson" wrote:

Did the code I supplied last time not work or did you need some kind of
modification of it...
--
HTH...

Jim Thomlinson


"Bob" wrote:

Columns A & B contain several thousand Project Numbers (e.g., P1052, PA844,
P6721.6, etc.). Column A has the latest list of Project Numbers. Column B
has an older list of Project Numbers. As such, column B is a subset of
column A. I need to find all of the €œnew€ (i.e., unique) Project Numbers
that exist in column A relative to column B, and put the results in column C.
Please note that row 1 is used for column headings, so the data contained in
columns A and B start in row 2.

I would appreciate any help in writing a macro that compares the Project
Numbers in columns A and B and outputs the unique Project Numbers to column C
(starting in row 2). The macro would know to stop when it encounters the
last Project Number in column A (FYI - there are blank cells after the last
Project Number in column A, which obviously is the longest of the two
columns).

Thanks for the help.
Bob

  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Finding Unique Entries Among Two Columns

Jim,
One more thing, the following lines in your code are showing up in red:

Function CreateDictionary(ByVal Target As Range) As

If Not dic.Exists(rngCurrent.Value) And rngCurrent.Value < Empty
Then 'Check the key

Bob


"Jim Thomlinson" wrote:

Did the code I supplied last time not work or did you need some kind of
modification of it...
--
HTH...

Jim Thomlinson


"Bob" wrote:

Columns A & B contain several thousand Project Numbers (e.g., P1052, PA844,
P6721.6, etc.). Column A has the latest list of Project Numbers. Column B
has an older list of Project Numbers. As such, column B is a subset of
column A. I need to find all of the €œnew€ (i.e., unique) Project Numbers
that exist in column A relative to column B, and put the results in column C.
Please note that row 1 is used for column headings, so the data contained in
columns A and B start in row 2.

I would appreciate any help in writing a macro that compares the Project
Numbers in columns A and B and outputs the unique Project Numbers to column C
(starting in row 2). The macro would know to stop when it encounters the
last Project Number in column A (FYI - there are blank cells after the last
Project Number in column A, which obviously is the longest of the two
columns).

Thanks for the help.
Bob

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Finding Unique Entries Among Two Columns

Bob,

This is because the line has been broken in the post/email:

So one line should read "Private Function CreateDictionary(ByVal Target As
Range) As Scripting.Dictionary" (with NO line breaks)

....and the other single line should read "If Not
dic.Exists(rngCurrent.Value) And rngCurrent.Value < Empty Then 'Check the
key" (also with NO line breaks)

It's just something that happens in the text wrapping of emails.

Regarding your other issue:

John,
When I change the first line to "Public" and then run the macro, I get the
following error message:

Compile error:
Sub or Function not defined

VBE then highlights "CreateDictionary" in the line:

Set Dic1 = CreateDictionary(rngRange1)


.....Have you added the reference that Jim mentioned? To do this go to
Tools/References in the programming window (VBE) and find and check the box
for "Microsoft Scripting Runtime", which should be about half way down the
list. Once checked it will move to the top of the list (or very near the
top).

Best regards

John

"Bob" wrote in message
...
Jim,
One more thing, the following lines in your code are showing up in red:

Function CreateDictionary(ByVal Target As Range) As

If Not dic.Exists(rngCurrent.Value) And rngCurrent.Value < Empty
Then 'Check the key

Bob


"Jim Thomlinson" wrote:

Did the code I supplied last time not work or did you need some kind of
modification of it...
--
HTH...

Jim Thomlinson


"Bob" wrote:

Columns A & B contain several thousand Project Numbers (e.g., P1052,
PA844,
P6721.6, etc.). Column A has the latest list of Project Numbers.
Column B
has an older list of Project Numbers. As such, column B is a subset of
column A. I need to find all of the "new" (i.e., unique) Project
Numbers
that exist in column A relative to column B, and put the results in
column C.
Please note that row 1 is used for column headings, so the data
contained in
columns A and B start in row 2.

I would appreciate any help in writing a macro that compares the
Project
Numbers in columns A and B and outputs the unique Project Numbers to
column C
(starting in row 2). The macro would know to stop when it encounters
the
last Project Number in column A (FYI - there are blank cells after the
last
Project Number in column A, which obviously is the longest of the two
columns).

Thanks for the help.
Bob





  #6   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Finding Unique Entries Among Two Columns

John,

Thanks for the info on the line breaks (I should have caught those). Yes, I
added the reference that Jim mentioned. BTW, I noticed an extra EndIf
statement in the code, so I deleted it. Now the macro runs fine without any
error messages, but unfortunately, it's NOT finding any unique entries (even
though several exist)! I'm getting a "No Matches" dialog box.

Any further help would be greatly appreciated.

Thanks again, Bob


"John" wrote:

Bob,

This is because the line has been broken in the post/email:

So one line should read "Private Function CreateDictionary(ByVal Target As
Range) As Scripting.Dictionary" (with NO line breaks)

....and the other single line should read "If Not
dic.Exists(rngCurrent.Value) And rngCurrent.Value < Empty Then 'Check the
key" (also with NO line breaks)

It's just something that happens in the text wrapping of emails.

Regarding your other issue:

John,
When I change the first line to "Public" and then run the macro, I get the
following error message:

Compile error:
Sub or Function not defined

VBE then highlights "CreateDictionary" in the line:

Set Dic1 = CreateDictionary(rngRange1)


.....Have you added the reference that Jim mentioned? To do this go to
Tools/References in the programming window (VBE) and find and check the box
for "Microsoft Scripting Runtime", which should be about half way down the
list. Once checked it will move to the top of the list (or very near the
top).

Best regards

John

"Bob" wrote in message
...
Jim,
One more thing, the following lines in your code are showing up in red:

Function CreateDictionary(ByVal Target As Range) As

If Not dic.Exists(rngCurrent.Value) And rngCurrent.Value < Empty
Then 'Check the key

Bob


"Jim Thomlinson" wrote:

Did the code I supplied last time not work or did you need some kind of
modification of it...
--
HTH...

Jim Thomlinson


"Bob" wrote:

Columns A & B contain several thousand Project Numbers (e.g., P1052,
PA844,
P6721.6, etc.). Column A has the latest list of Project Numbers.
Column B
has an older list of Project Numbers. As such, column B is a subset of
column A. I need to find all of the "new" (i.e., unique) Project
Numbers
that exist in column A relative to column B, and put the results in
column C.
Please note that row 1 is used for column headings, so the data
contained in
columns A and B start in row 2.

I would appreciate any help in writing a macro that compares the
Project
Numbers in columns A and B and outputs the unique Project Numbers to
column C
(starting in row 2). The macro would know to stop when it encounters
the
last Project Number in column A (FYI - there are blank cells after the
last
Project Number in column A, which obviously is the longest of the two
columns).

Thanks for the help.
Bob




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Finding Unique Entries Among Two Columns

Send me an e-mail. I have an addin that incorporrates exactly what you are
looking for (among a bunch of other kind funky stuff). I will send it to
you...
--
HTH...

Jim Thomlinson


"Bob" wrote:

John,

Thanks for the info on the line breaks (I should have caught those). Yes, I
added the reference that Jim mentioned. BTW, I noticed an extra EndIf
statement in the code, so I deleted it. Now the macro runs fine without any
error messages, but unfortunately, it's NOT finding any unique entries (even
though several exist)! I'm getting a "No Matches" dialog box.

Any further help would be greatly appreciated.

Thanks again, Bob


"John" wrote:

Bob,

This is because the line has been broken in the post/email:

So one line should read "Private Function CreateDictionary(ByVal Target As
Range) As Scripting.Dictionary" (with NO line breaks)

....and the other single line should read "If Not
dic.Exists(rngCurrent.Value) And rngCurrent.Value < Empty Then 'Check the
key" (also with NO line breaks)

It's just something that happens in the text wrapping of emails.

Regarding your other issue:

John,
When I change the first line to "Public" and then run the macro, I get the
following error message:

Compile error:
Sub or Function not defined

VBE then highlights "CreateDictionary" in the line:

Set Dic1 = CreateDictionary(rngRange1)


.....Have you added the reference that Jim mentioned? To do this go to
Tools/References in the programming window (VBE) and find and check the box
for "Microsoft Scripting Runtime", which should be about half way down the
list. Once checked it will move to the top of the list (or very near the
top).

Best regards

John

"Bob" wrote in message
...
Jim,
One more thing, the following lines in your code are showing up in red:

Function CreateDictionary(ByVal Target As Range) As

If Not dic.Exists(rngCurrent.Value) And rngCurrent.Value < Empty
Then 'Check the key

Bob


"Jim Thomlinson" wrote:

Did the code I supplied last time not work or did you need some kind of
modification of it...
--
HTH...

Jim Thomlinson


"Bob" wrote:

Columns A & B contain several thousand Project Numbers (e.g., P1052,
PA844,
P6721.6, etc.). Column A has the latest list of Project Numbers.
Column B
has an older list of Project Numbers. As such, column B is a subset of
column A. I need to find all of the "new" (i.e., unique) Project
Numbers
that exist in column A relative to column B, and put the results in
column C.
Please note that row 1 is used for column headings, so the data
contained in
columns A and B start in row 2.

I would appreciate any help in writing a macro that compares the
Project
Numbers in columns A and B and outputs the unique Project Numbers to
column C
(starting in row 2). The macro would know to stop when it encounters
the
last Project Number in column A (FYI - there are blank cells after the
last
Project Number in column A, which obviously is the longest of the two
columns).

Thanks for the help.
Bob




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 entries across columns bollard Excel Worksheet Functions 2 May 6th 08 03:04 PM
Counting unique entries across two or three columns [email protected] Excel Worksheet Functions 17 February 17th 08 01:50 AM
Finding unique entries among two columns of alphanumeric data Bob Excel Worksheet Functions 10 October 23rd 06 02:40 PM
Finding Unique Entries Among Two Columns Jim Thomlinson Excel Programming 4 June 22nd 06 06:50 PM
Finding Unique Entries Among Two Columns John[_88_] Excel Programming 1 June 21st 06 09:30 PM


All times are GMT +1. The time now is 03: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"