Using Application.match against one dimension of a multidimensional array?

  • Thread starter Thread starter KR
  • Start date Start date
K

KR

This probably has a simple answer (either simple syntax, or it simply can't
be done).

I am parsing one string to get a key value, TargetName ("Steve P. Jacobs").
I have another array [AllInfo(1 to 100, 1 to 5)] where AllInfo(x,1) holds
the name, and AllInfo(x,2) holds another variable, say, phone number, etc.

* AllInfo (x,1) is equivalent to a key field, i.e. there are no repeats.
* AllInfo is not sorted

What I'd like to do is (based on the string I parsed) locate the phone
number in AllInfo(x,2) associated with the record that has AllInfo(x,1)=
"Steve P. Jacobs"

When using a one dimensional array I used:
Application.Match(SourceString,MyOneDimensionalArrayName,0)

but now I need to specify /which/ field in AllInfo(x,y) to check- so it
seems like it would be something like:
Application.Match(TargetName,(MyTwoDimensionalArrayName(,1),0)

but that doesn't seem to work... any advice? (other than switching to MS
Access, that is) :)

Thanks!
Keith
 
res = Application.Match(sName,Application.Index(AllInfo,0,1),0)

AllInfo should have less than 5461 elements (which yours does).

Change the 1 to the column you want to check.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top