FiascoBurnett
Programmer
Hi
I’ve been struggling with this problem for a while, and perhaps somebody can help.
I have a 2-column array, e.g. as follows
3 2
6 4
12 0
- - - -
22 3
23 10
. .
. .
. .
66 4
I need to search column 1 (which is in ascending order) until I find a specified number, e.g. 12, then find the maximum value in column 2 up to that point, i.e. 4. I then need to find the number in the first column corresponding to this, i.e. 6. Then continue down the array until we see 4 again in the second column and return the corresponding number in the first column, i.e. 66.
There must be a concise and elegant way to do this, perhaps using intrinsic functions.
I’ve been struggling with this problem for a while, and perhaps somebody can help.
I have a 2-column array, e.g. as follows
3 2
6 4
12 0
- - - -
22 3
23 10
. .
. .
. .
66 4
I need to search column 1 (which is in ascending order) until I find a specified number, e.g. 12, then find the maximum value in column 2 up to that point, i.e. 4. I then need to find the number in the first column corresponding to this, i.e. 6. Then continue down the array until we see 4 again in the second column and return the corresponding number in the first column, i.e. 66.
There must be a concise and elegant way to do this, perhaps using intrinsic functions.