I needed to do this at work (SPG), and google's AI worked marvelously, as easy as it maybe for advanced Excel Formula experts which I am not.
Ingenious solution by Google:
In Excel, you can return a row number based on multiple criteria using a combination of the INDEX and MATCH functions. For users with newer versions of Excel (Microsoft 365, 2021), the FILTER function is a more straightforward alternative.
Example scenario
Imagine you have a table with sales data that includes Product, Region, and Sales. Your goal is to find the row number for the entry where the Product is "Mug" and the Region is "West".
| A | B | C | |
|---|---|---|---|
| 1 | Product | Region | Sales |
| 2 | T-Shirt | East | $150 |
| 3 | Mug | West | $200 |
| 4 | T-Shirt | West | $120 |
| 5 | Mug | East | $180 |
Formula:=MATCH(1, (A2:A5="Mug")*(B2:B5="West"), 0)
How it works:
(A2:A5="Mug")creates an array ofTRUEorFALSEvalues. In our example, it becomes{FALSE;TRUE;FALSE;FALSE}.(B2:B5="West")does the same for the second condition, creating{FALSE;TRUE;TRUE;FALSE}.- The multiplication operator
*acts as anANDoperator. Excel treatsTRUEas1andFALSEas0, so the formula multiplies the two arrays element by element. Only the row where both conditions areTRUEwill result in a1. The resulting array is{0;1;0;0}. MATCH(1, {0;1;0;0}, 0)then searches for the value1in this new array and returns its relative position. In this case, it's the second position.