LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Better way to find matches across multiple cells?

I came up with the following worksheet formula, beacuse as I cycle through
each row on one sheet, I need to find the corresponding record on the other
sheet to pull some additional data. There are two identifiers that must both
be used to find the unique matching row.

{=MATCH(D8&J8,('Raw'!A1:A65000)&('Raw'!C1:C65000), FALSE)}

The problem, of course, is that due to the size of the array from the second
sheet, each match takes way too long (in excess of 5 seconds per row, with
an average of 8000-10000 rows that I need to process). The second sheet will
often be full or close to full, which is why I'm going to 65K rows.

Is a find loop (like below) where I reset the range after every false match
the fastest option, or is there a better way to do this in VBA? This seems
overly complicated, especially since I'm not sure how many false matches
(non-matching values) there would be (it can vary) so I'm not sure how to
determine how many loops I should use. (or maybe with the exit for, it
doesn't matter?)

I'm currently looking at something like the aircode below, but it just
doesn't seem elegant. For example, if a match of the initial number isn't
found at all (which is possible) then it would crash as soon as the match
function returned an error (on the line that tries to increment the
RawRangeStart to NA()+1). If there is a better way than my frantic looping,
please let me know.
Thanks,
Keith
XP/XL2003

For i = 1 to 8000
RawRangeStart = 1
for multiplevalues = 1 to 10 'or 20? I don't know how many false
matches I need to prepare for
set rangeA = Sheet(Raw).range("A" & Cstr(RawRangeStart) & ":A65000")
'resize the range
x = Application.match(valuefromD, rangeA,False) 'find the match in the
remainder of the range
if valuefromJ=valuefromC then
'do my calculations
exit for 'I think this drops just to the most recent for,
the multiplevalues and not the i loop?
else
RawRangeStart = x + 1
end if
Next multiplevalues
Next i


 
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
how do i find multiple matches of one data item in an excel range DivaHouston Excel Discussion (Misc queries) 1 January 7th 08 02:43 PM
Add up Values if Find Matches x 2 Sean Excel Worksheet Functions 9 November 16th 07 12:21 PM
How do I count cells that matches multiple criteria in Excel? MEAD5432 Excel Worksheet Functions 2 February 26th 07 04:48 PM
INTRICATE PROBLEM- How to find multiple text,excluding "H", in a multiple range of cells, then replacing 0 with another number in another cell Tourcat Excel Worksheet Functions 1 February 8th 05 06:26 PM
MATCH function - how to find multiple matches ?? Keith Excel Programming 6 March 2nd 04 01:50 PM


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

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"