LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default VBA equivalent of VLookup on an array

I have a large array:

Public TotalDataArray(1 To 6, 1 To 30, 1 To 65000) As Variant

(I'll shorten that last parameter once I know the maximum number of lines
that the source query can return, but it will still be big- the last report
I got was accidently truncated at 34K rows, so the total number will still
be very large)

I'm cycling through a sheet and pulling numbers off a particular column that
I need to check against the array; if that number is found, I need to know
where so I can pull a related number from the array. Example:

TotalDataArray(5,18,1) = cat
TotalDataArray(5,18,2) = dog
TotalDataArray(5,18,3) = bird
TotalDataArray(5,18,4) = worm

in a target cell on my worksheet I find "dog", which (when I figure out how
to find the match) will return (5,18,2). I need to know the "2" so I can
pull back out:
(5,15,2) = vertibrate, and (5,16,2) = mammal

My curent level of sophistication would be to cycle through all (up to)
65000 elements to look for a match, and do this for each of the hundreds of
cells in my file. the problem is I have to do this with different parts of
my array, for a total of about 15 times...so I'm worried this will end up
taking forever to run.

Is there an easier way to detect the location/match in one dimension of a
3-D array, other than cycling through each element?

Many thanks,
Keith


--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.


 
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
VLOOKUP & Array AlanR Excel Worksheet Functions 8 April 1st 09 02:48 AM
Vlookup in vlookup - taking the result as array name SupperDuck Excel Worksheet Functions 2 June 2nd 07 11:05 AM
How do I create an equivalent VLOOKUP function using FIND? dan Excel Worksheet Functions 8 August 17th 05 04:43 PM
searching for vlookup equivalent in VBA Tom Ogilvy Excel Programming 0 August 31st 04 06:20 PM
VB's equivalent to VLOOKUP? Dan Excel Programming 4 June 9th 04 08:47 PM


All times are GMT +1. The time now is 06:38 AM.

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"