Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Comparing multiple fields in an array with multiple fields in a table.

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Comparing multiple fields in an array with multiple fields in a ta

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


" 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Comparing multiple fields in an array with multiple fields in a ta

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
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
Comparing Multiple fields eyespike1 Excel Discussion (Misc queries) 3 February 12th 10 08:39 PM
pivot table multiple column fields Natalie Excel Discussion (Misc queries) 3 October 6th 09 11:15 AM
Use multiple page fields in pivot table Pair_of_Scissors[_2_] Excel Worksheet Functions 7 October 20th 08 07:01 PM
Multiple Fields In Multiple Ranged Pivot Table FARAZ QURESHI Excel Discussion (Misc queries) 0 September 19th 07 07:08 AM
Pivot Table with Multiple Row Fields Matt Cromer Excel Discussion (Misc queries) 3 May 26th 05 06:30 PM


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