When one column isn’t enough to identify a row — you need the price for a specific product in a specific size — you do a two-criteria lookup. The trick is to join the keys together, either inside XLOOKUP or with INDEX/MATCH.
The example
A price list keyed by product + size. We want the Widget / Large price.
| A | B | C | |
|---|---|---|---|
| 1 | Product | Size | Price |
| 2 | Widget | Small | $10 |
| 3 | Widget | Large | $18 |
| 4 | Gadget | Small | $12 |
| 5 | Gadget | Large | $20 |
The formula
The price where product = Widget and size = Large:
How it works
The lookup matches a combined key:
- On the right,
A2:A5&"|"&B2:B5builds a temporary key column: "Widget|Small", "Widget|Large", … - On the left,
"Widget"&"|"&"Large"builds the same kind of key from your two criteria. - XLOOKUP finds the one combined key that matches and returns the price beside it.
- The
"|"separator prevents false matches (so "ab"+"c" can’t collide with "a"+"bc").
If the result is a number you can add, SUMIFS is simplest. =SUMIFS(C2:C5, A2:A5, G2, B2:B5, G3) returns the price directly — no concatenation — as long as each product+size pair is unique.
Try it: interactive demo
Choose a product and size; the combined-key lookup finds the price.
Variations
Legacy INDEX/MATCH (array-entered)
Excel 2019 and older — confirm with Ctrl+Shift+Enter:
Numeric result: use SUMIFS
If the answer is a number and the key is unique:
Three or more criteria
Just chain more keys with the same separator:
Pitfalls & errors
#N/A. The combined key didn’t match — usually a stray space or different capitalization in one column. Wrap each side in TRIM, and remember XLOOKUP isn’t case-sensitive.
Always use a separator. Without one, "12"+"3" and "1"+"23" both become "123" and match wrongly. A "|" (or any character not in your data) prevents this.
Legacy INDEX/MATCH needs array entry. The concatenated-range version must be entered with Ctrl+Shift+Enter in Excel 2019 and older.
Practice workbook
Frequently asked questions
How do I look up a value with two criteria in Excel?
How do I do a multi-criteria lookup without XLOOKUP?
Why use a separator like | between keys?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class