where “code” is the named range B5:B12. Note: this is an array formula and must be entered with control + shift + enter. Here, each value in the named range “code” is evaluated with the logical test “first letter is not N”. The result is an array or TRUE and FALSE values like this: This array is fed into the MATCH function as the lookup array. The lookup value is TRUE, and match type is set to zero to force an exact match. The MATCH function returns the position of the first value that does not begin with the letter “N” (Z09876), which is 5.

INDEX and MATCH

To retrieve a value associated with the position returned by MATCH, you can add the INDEX function. In example shown, the formula in F6 is: Note we are using the same MATCH formula above to provide a row number to INDEX, with the array set to the named range “value”. As before, MATCH returns 5. INDEX then returns the value at that position, -23. As before, this is an array formula and must be entered with control + shift + enter.

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.