find closest instance of specific value in array

T

Travis

I have an array of data where some data may appear multiple times
throughout the array. I am trying to find a way to locate the next
closest instance of a given value in an array, recognizing that the
value may appear multiple times in the array.

Example:
Array of values in A1:A10 as follows:
a,b,c,d,e,f,a,g,e,b

I want to find the location in the array that has value "b" closest to
cell A4 in the array. It should return location A2.

Any help would be much appreciated!

Travis
 
L

Lori

This was answered yesterday. The location in the array is given by:

=MATCH(1,(A1:A10="b")*((ROW(A1:A10)-ROW(A4))^2=MIN(IF(A1:A10="b",(ROW(A1:A10)­-ROW(A4))^2))),0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top