PC Review


Reply
Thread Tools Rate Thread

Comparing multiple fields in an array with multiple fields in a table.

 
 
lisamariechemistry@yahoo.com
Guest
Posts: n/a
 
      14th Jun 2007
I have an array of n records with 2 fields (say, "Name" and "Date"),
and a worksheet table of many rows (eventually thousands) and many
columns, including the two columns in the array. I need to compare
each record in the array to find out if that Name/Date combo already
exists in any row of the spreadsheet table. (...and add it to the
table if not already represented but that's the easy part) Although
the number of rows in the table will become large, n will usually be
<10.

I can think of various ways to proceed (using various permutations of
autofilter, .find, concatenating, etc.) but none are particularly
elegant.

Is there one approach that is more programmatically "correct" than the
others?

I know enough to get the job done but it might not be very pretty.
I'm teaching myself as I go and I'd like to teach myself "right" if
there's a "right" way. Thanks! -Lisa

 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      14th Jun 2007
for each row in the array,
search all the cells of the table using the find command for the name or
date which you expect to be present in the fewest number of rows.
for each row that contains that value, use the find command to find the
other value (date or name). Each time a row contains both, do what you need
to do.

For autofilter, use a dummy column put in two countifs - one for name, one
for date - and sum the results. Then autofilter on that column for value of
2.
you could then autofilter on the dummy column. You can have the second
argument of each countif refer to a cell, then enter you name and date as you
loop through the array - applying the autofilter each time.

Try both methods and see which works best.

--
Regards,
Tom Ogilvy



--
Regards,
Tom Ogilvy


"(E-Mail Removed)" wrote:

> I have an array of n records with 2 fields (say, "Name" and "Date"),
> and a worksheet table of many rows (eventually thousands) and many
> columns, including the two columns in the array. I need to compare
> each record in the array to find out if that Name/Date combo already
> exists in any row of the spreadsheet table. (...and add it to the
> table if not already represented but that's the easy part) Although
> the number of rows in the table will become large, n will usually be
> <10.
>
> I can think of various ways to proceed (using various permutations of
> autofilter, .find, concatenating, etc.) but none are particularly
> elegant.
>
> Is there one approach that is more programmatically "correct" than the
> others?
>
> I know enough to get the job done but it might not be very pretty.
> I'm teaching myself as I go and I'd like to teach myself "right" if
> there's a "right" way. Thanks! -Lisa
>
>

 
Reply With Quote
 
lisamariechemistry@yahoo.com
Guest
Posts: n/a
 
      14th Jun 2007
Thanks! I'm going with the first method you described. I didn't run
any timed tests but I prefer not to add extra columns when it can be
avoided.

-Lisa

 
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
Comparing Multiple fields eyespike1 Microsoft Excel Misc 3 12th Feb 2010 08:39 PM
Comparing a field in one table against multiple fields in another JK Microsoft Access VBA Modules 14 7th Aug 2008 04:01 PM
Relating multiple fields in table to multiple fields in another ta =?Utf-8?B?UmFuZGFsbE1K?= Microsoft Access Database Table Design 3 9th Jan 2006 02:46 PM
comparing multiple fields =?Utf-8?B?RmlzaA==?= Microsoft Access Getting Started 1 29th May 2004 02:49 AM
comparing multiple fields =?Utf-8?B?RmlzaA==?= Microsoft Access Queries 1 28th May 2004 10:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:13 AM.