Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Finding a series of values within an Array
I have a two-dimensional array, sorted along one dimension:
e.g. array(n,1) array(n,2) 10 10020 10 20127 10 30568 11 09654 11 21678 11 54689 12 65894 .. .. 99 11111 I want to quickly find only those rows (n) within the array that match a particular value so that I can limit some looping to only that area of the array. For instance, let's say I was able to find out that for the value "11", the lower bound is 4 (if n starts at 1) and the upper bound is 6. Any suggestion? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Finding a series of values within an Array
Hi Marston;
My hack is that you could either (1) put the information into a sheet and then use the pivot table object or (2) it really seems like a databasing need so put it into Sequel and then query it if you can. On other option is that you could write it to a CSV file and then use a dynamic DSN to execute a sequel statement against it using a text driver. Others may have better ideas, Thanks, Greg -----Original Message----- I have a two-dimensional array, sorted along one dimension: e.g. array(n,1) array(n,2) 10 10020 10 20127 10 30568 11 09654 11 21678 11 54689 12 65894 .. .. 99 11111 I want to quickly find only those rows (n) within the array that match a particular value so that I can limit some looping to only that area of the array. For instance, let's say I was able to find out that for the value "11", the lower bound is 4 (if n starts at 1) and the upper bound is 6. Any suggestion? . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Finding a series of values within an Array
whatever actually provided that information would need to loop or search.
As far as I know, there is nothing that does, so you need to loop or search yourself. If you can count on the searched column being sorted, then use a binary search check if it is below the lowest value or higher than the upper value, if so quit. go to the center of the array, is it equal to the value: done is it less than the value repeat for the lower part of the array is it greater than the value repeat for the upper part of the array now that you have found the value, you can loop down and up to find the extent of the value If it is going to be a repetitive process you could preprocess the array to gather that information in another array. -- Regards, Tom Ogilvy " wrote in message ... I have a two-dimensional array, sorted along one dimension: e.g. array(n,1) array(n,2) 10 10020 10 20127 10 30568 11 09654 11 21678 11 54689 12 65894 . . 99 11111 I want to quickly find only those rows (n) within the array that match a particular value so that I can limit some looping to only that area of the array. For instance, let's say I was able to find out that for the value "11", the lower bound is 4 (if n starts at 1) and the upper bound is 6. Any suggestion? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Finding a series of values within an Array
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Finding next number in a series | Excel Worksheet Functions | |||
Finding the Max, Min values based on certain criteria for an array | Excel Discussion (Misc queries) | |||
Finding Minimum Value in series, excluding zero values | Excel Worksheet Functions | |||
Finding series index if I know the Series Name | Charts and Charting in Excel | |||
Need help finding unique values and transforming an n x 1 Array | Excel Programming |