Share via

Find a value in a 2 dimensional array

Anonymous
2020-02-27T19:27:12+00:00

I have data stored in the range K11:AD25. Row 11 has the numbers from 1 to 20 in the columns K to AD. The cells in rows 12 to 25 each contain unique values.

Using data validation, the user can specify a value that occurs in the array and I would like to return the value in row 11 of the column that the data was found in.

           K            L            M            N            O     etc.

11       1            2             3            4             5       

12   100KC    304BC    205KH    501BH    402KC

13   102KC    305BC    207KH    505BH    406KC

etc.

For example, if the user was searching for 207KH, I want it to return 3.

Is this possible with Excel functions or does it require nested DO loops in VBA?

TIA

David

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Ashish Mathur 101.9K Reputation points Volunteer Moderator
2020-02-27T23:54:18+00:00

Hi,

Type 207KH in cell A1 and this formula in cell B1

=INDEX($K$11:$O$11,1,SUMPRODUCT(($K$12:$O$13=A1)*(COLUMN($K$11:$O$11)-COLUMN($J$11))))

Hope this helps.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Ashish Mathur 101.9K Reputation points Volunteer Moderator
    2020-02-28T02:40:42+00:00

    You are welcome.  If my reply helped, please mark it as Answer.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2020-02-28T02:19:36+00:00

    Amazing Ashish! It works like a charm! I'm going through it step by step to understand how it works. Thanks so much!

    David

    Was this answer helpful?

    0 comments No comments