Using Application.match against one dimension of a multidimensional array?
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,MyOneDimensionalArr ayName,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,(MyTwoDimensionalArra yName(,1),0) but that doesn't seem to work... any advice? (other than switching to MS Access, that is) :) 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. |
Using Application.match against one dimension of a multidimensional array?
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. -- Regards, Tom Ogilvy "KR" wrote in message ... 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,MyOneDimensionalArr ayName,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,(MyTwoDimensionalArra yName(,1),0) but that doesn't seem to work... any advice? (other than switching to MS Access, that is) :) 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. |
All times are GMT +1. The time now is 02:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com