where data (D6:H16), diameter (D5:H5), material (B6:B16), and hardness (C6:C16) are named ranges used for convenience only. Note: this is an array formula and must be entered with Control + Shift + Enter This can be done with a two-way INDEX and MATCH formula. One MATCH function works out the row number (material and hardness), and the other MATCH function finds the column number (diameter). The INDEX function returns the final result.

In the example shown, the formula in K8 is: (Line breaks added for readability only). The tricky bit is that material and hardness need to be handled together. We need to restrict MATCH to the hardness values for a given material (Low Carbon Steel in the example shown). We can do this with the IF function. Essentially, we use IF to “throw away” irrelevant values before we look for a match.

Details

The INDEX function is given the named range data (D6:H16) as for array. The first MATCH function works out the row number: To locate the correct row, we need to do an exact match on material, and an approximate match on hardness. We do this by using the IF function to first filter out irrelevant hardness: We test all of the values in material (B6:B16) to see if they match the value in K5 (“Low Carbon Steel”). If so, the hardness value is passed through. If not, IF returns FALSE. The result is an array like this: Notice the only surviving values are those associated with Low Carbon Steel. The other values are now FALSE. This array is returned directly to the MATCH function as the lookup_array. The lookup value for match comes from K6, which contains the given hardness, 176. MATCH is configured for approximate match by setting match_type to 1. With these settings, MATCH ignores FALSE values and returns the position of an exact match or the next smallest value. Note: hardness values must be sorted in ascending order for each material. With hardness given as 176, MATCH returns 6, delivered directly to INDEX as the row number. We can now rewrite the original formula like this: The second MATCH formula finds the correct column number by performing an approximate match on diameter: Note: values in diameter D5:H5 must be sorted in ascending order. The lookup value comes from K7 (0.75), and the lookup_array is the named range diameter (D5:H5). As before, the MATCH is set to approximate match by setting match_type to 1. With diameter given as 0.75, MATCH returns 3, delivered directly to the INDEX function as the column number. The original formula now resolves to: INDEX returns a final result of 0.015, the value from F11.

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.