Youu can make use of Excel's INDEX and MATCH functions
The INDEX function's syntax and usage
The Excel INDEX function returns a value in an array based on the row and column numbers you specify. The syntax of the INDEX function is straightforward:
INDEX(array, row_num, [column_num])
Here is a very simple explanation of each parameter:
array - this is a range of cells that you want to return a value from.
row_num - the row number in array from which you want to return a value. If omitted, the column_num is required.
column_num - the column number in array from which you want to return a value. If omitted, row_num is required.
If both row_num and column_num parameters are used, the INDEX function returns the value in the cell at the intersection of the specified row and column.
And here is the simplest example of the INDEX formula:
=INDEX(A1:C10,2,3)
The formula searches in cells A1 through C10 and returns a value of the cell in the 2nd row and the 3rd column, i.e. cell C2.
Very easy, right? However, when working with real data you would hardly ever know which row and column you want, that is why you need the help of the MATCH function.
The MATCH function's syntax and usage
The Excel MATCH function searches for a lookup value in a range of cells, and returns the relative position of that value in the range.
For example, if the range B1:B3 contains the values "New-York", "Paris", "London", then the formula =MATCH("London",B1:B3,0) returns the number 3, because "London" is the third entry in the range.
The syntax of the MATCH function is as follows:
MATCH(lookup_value, lookup_array, [match_type])
lookup_value - this is the number or text you are looking for. This can be a value, a cell reference or logical value.
lookup_array - a range of cells being searched.
match_type - this parameter tells the MATCH function whether you want to return an exact match or the nearest match:
1 or omitted - finds the largest value that is less than or equal to the lookup value. The values in the lookup array must be sorted in ascending order, i.e. from smallest to largest.
0 - finds the first value that is exactly equal to the lookup value. In the INDEX / MATCH combination, you almost always need the exact match, so the third argument of your MATCH function is "0".
-1 - finds the smallest value that is greater than or equal to lookup_value. The values in the lookup array must be sorted in descending order, i.e. from largest to smallest.
For more information about the MATCH function, please see How to use MATCH function in Excel.
At first sight, the usefulness of the MATCH function may seem questionable. Who cares about the position of a value in a range? What we do want to know is the value itself.
Let me remind you that the relative position of the lookup value (i.e. a row or/and column number) is exactly what you need to supply to the row_num or/and column_num argument of the INDEX function. As you remember, the INDEX function can return the value at the juncture of a given row and column, but it cannot determine which exactly row and column you want.