Jedidia

asked on

# Find closest value in a multidim array

I have a multidim array that has hundreds of records and it.

For array(i, 2) the data looks like this:

array(0,2) = 121

array(1,2) = 3121

array(2,2) = 5121

array(3,2) = 6121

......

I perform a calculation and get a random value of 4010 and want to search the array(I, 2) for the closest (rounded up) value in the array.

What's the best way of going about this.

Thanks

For array(i, 2) the data looks like this:

array(0,2) = 121

array(1,2) = 3121

array(2,2) = 5121

array(3,2) = 6121

......

I perform a calculation and get a random value of 4010 and want to search the array(I, 2) for the closest (rounded up) value in the array.

What's the best way of going about this.

Thanks

ASKER

no sorting of the array.

I actually don't care about the calculated value of 4010...I am just looking for the closest value (rounded up) in the array.

I actually don't care about the calculated value of 4010...I am just looking for the closest value (rounded up) in the array.

ASKER CERTIFIED SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

And when you say rounded up the 4010 becomes 5121?