Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to find out if certain values are in one part of a multidimensional
array. In the past I've used application.match against 1-dimensional arrays to see if it throws an error (which tells me it isn't in the array). Unfortunately I can't find any help for match or application.match in the VBE help. Using XL2003 on Win2000. Can I do the same thing with a multidimensional array, and if so, what is the proper way to identify the array in the match? e.g. should I just have the array name (MySource()) or do I need to specify the part of the array to search (MySource(1,)) Or do I have to copy the part of the array where I want to check for matches to a new 1-D array? That would be inefficient, since I'll be looping and adding hundreds (maybe thousands) of entries...but I have to find the matches (or lack thereof), so I'm open to options. I'd prefer not to deal with collections if there is a way to keep all this in my array. 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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Keith,
Are you using data in cells as your array, or are you working on an array in code? In either case, you could use the Find method on a range (paste the range to a temp range if you are using an array). HTH, Bernie MS Excel MVP "KR" wrote in message ... I need to find out if certain values are in one part of a multidimensional array. In the past I've used application.match against 1-dimensional arrays to see if it throws an error (which tells me it isn't in the array). Unfortunately I can't find any help for match or application.match in the VBE help. Using XL2003 on Win2000. Can I do the same thing with a multidimensional array, and if so, what is the proper way to identify the array in the match? e.g. should I just have the array name (MySource()) or do I need to specify the part of the array to search (MySource(1,)) Or do I have to copy the part of the array where I want to check for matches to a new 1-D array? That would be inefficient, since I'll be looping and adding hundreds (maybe thousands) of entries...but I have to find the matches (or lack thereof), so I'm open to options. I'd prefer not to deal with collections if there is a way to keep all this in my array. 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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm using several arrays in code (memory); the smaller array keeps a subset
of values that I'm tracking, and with each iteration of my code, it checks that subset against the larger set to grab additional values. The larger array is approximately (1 to 10, 1 to 5000) and the smaller array can be anywhere from (1 to 10, 1 to 100) up to (1 to 10, 1 to 5000) where the latter would end up including every element from the source array. In my case, I'm going through up to 10 iterations where in each case I'm checking for a cascade of values in the source array (thus my iterations); for example, lets assume that it is a list of 5000 people who all know at least some of the other people on the list. I might decide that I want to know who I listed as my friends, in which case I'll only check to see who I had listed as friends. Or I might want to know 1 degree of separation, in which case I'll iterate through my own friends to generate a new source list, then using that, I'll check for every unique value of any name that me and my immediate friends have listed as friends...and so on... I can iterate through my source array just fine, what I'm trying to do is determine if each name that is found is unique to my sublist array so that I can add it (and related information) if needed. My alternative is to keep a single-dimension array just for the match criteria, and add each new record to both that and my multidimensional sublist at the same time. My concern about using the sheets is just speed more than anything else- but perhaps I should go test it to see if it really slows down the code that much... Thanks! Keith "Bernie Deitrick" <deitbe @ consumer dot org wrote in message ... Keith, Are you using data in cells as your array, or are you working on an array in code? In either case, you could use the Find method on a range (paste the range to a temp range if you are using an array). HTH, Bernie MS Excel MVP "KR" wrote in message ... I need to find out if certain values are in one part of a multidimensional array. In the past I've used application.match against 1-dimensional arrays to see if it throws an error (which tells me it isn't in the array). Unfortunately I can't find any help for match or application.match in the VBE help. Using XL2003 on Win2000. Can I do the same thing with a multidimensional array, and if so, what is the proper way to identify the array in the match? e.g. should I just have the array name (MySource()) or do I need to specify the part of the array to search (MySource(1,)) Or do I have to copy the part of the array where I want to check for matches to a new 1-D array? That would be inefficient, since I'll be looping and adding hundreds (maybe thousands) of entries...but I have to find the matches (or lack thereof), so I'm open to options. I'd prefer not to deal with collections if there is a way to keep all this in my array. 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
check value with array, Application.Match | Excel Programming | |||
Referencing multidimensional array | Excel Programming | |||
Using Application.match against one dimension of a multidimensional array? | Excel Programming | |||
Multidimensional Array | Excel Programming | |||
MAX of Multidimensional Array | Excel Programming |