To look up a value based on multiple criteria in Excel, you cannot use VLOOKUP directly because it only accepts a single lookup value. Instead, use INDEX and MATCH with an array formula, or use XLOOKUP (Excel 2021/Microsoft 365) which natively supports multiple criteria. For example, =XLOOKUP(1, (A:A="Product A")*(B:B="Red"), C:C) returns the price of a red Product A.
Why VLOOKUP Fails with Multiple Criteria
VLOOKUP’s syntax is VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]). It searches for a single value in the first column of a table and returns a value from a specified column in the same row. It cannot check two columns at once. For instance, if you have a table with Product, Color, and Price, and you want the price of a specific product in a specific color, VLOOKUP can only match on one column, so it will return the first match for that product, regardless of color.
Solution 1: Helper Column (Works in All Versions)
The simplest workaround is to create a helper column that concatenates the criteria into one value, then use VLOOKUP on that column. Steps:
- Insert a new column (e.g., column A) in your lookup table.
- In cell A2, enter
=B2&"|"&C2(assuming B has Product and C has Color). Drag down. - In your lookup cell, create a combined lookup value:
=E2&"|"&F2(where E and F are your criteria). - Use
=VLOOKUP(combined, A:D, 4, FALSE)to return the price from column D.
This works in every Excel version and is easy to maintain. Use a delimiter like “|” to avoid accidental matches (e.g., “AB” & “C” vs “A” & “BC”).
Solution 2: INDEX and MATCH with Array Formula
For a no-helper-column approach, use INDEX and MATCH with an array formula. With data in A2:C10 (Product, Color, Price) and criteria in E2 and F2, enter:
=INDEX(C2:C10, MATCH(1, (A2:A10=E2)*(B2:B10=F2), 0))
In Excel 365 and 2021, this works as a dynamic array formula. In older versions, you must press Ctrl+Shift+Enter to enter it as an array formula. The (A2:A10=E2)*(B2:B10=F2) creates an array of 1s and 0s where both conditions are true; MATCH finds the first 1.
Solution 3: XLOOKUP with Boolean Logic (Excel 2021/Microsoft 365)
XLOOKUP is the modern replacement and handles multiple criteria elegantly. Syntax: =XLOOKUP(1, (A:A=E2)*(B:B=F2), C:C). This works without Ctrl+Shift+Enter in Excel 365 and Excel 2021. It is faster and more flexible than VLOOKUP. For example, if A:A contains products, B:B colors, and C:C prices, the formula returns the price where both match.
Note: XLOOKUP is not available in Excel 2019 or earlier; use INDEX/MATCH or helper column there.
How to Choose the Right Method
Consider your Excel version and data size:
- Excel 365/2021: Use XLOOKUP – simplest and most efficient.
- Excel 2019 or older: Use INDEX/MATCH with Ctrl+Shift+Enter, or a helper column.
- Large datasets (100k+ rows): XLOOKUP or INDEX/MATCH are faster than VLOOKUP with helper columns because they avoid extra calculations.
- Ease of maintenance: Helper columns are transparent but add clutter; array formulas are compact but harder to audit.
Common Problems and How to Fix Them
- #N/A error: No match found. Check that criteria exactly match (including spaces and text case). Use TRIM and PROPER if needed.
- Array formula not calculating: In older Excel, if you forget Ctrl+Shift+Enter, you get #VALUE!. Re-enter with the key combination.
- Multiple matches: Both INDEX/MATCH and XLOOKUP return the first match. If you need the last match, use XLOOKUP with match_mode=-1 or use LOOKUP(2,1/((A:A=E2)*(B:B=F2)),C:C).
- Case-sensitive lookup: VLOOKUP and XLOOKUP are case-insensitive by default. Use EXACT in an array formula:
=INDEX(C2:C10, MATCH(TRUE, EXACT(A2:A10,E2)*EXACT(B2:B10,F2), 0)).
Alternatives: FILTER and SUMPRODUCT
If you need to return multiple matches, use FILTER (Excel 365): =FILTER(C2:C10, (A2:A10=E2)*(B2:B10=F2)) returns all prices that match. For a numeric result like a sum or average, use SUMIFS or AVERAGEIFS: =SUMIFS(C2:C10, A2:A10, E2, B2:B10, F2). These are dedicated multi-criteria functions and are often more efficient than array formulas.
Frequently Asked Questions
Can I use VLOOKUP with two columns as the lookup value?
No, VLOOKUP only accepts a single lookup value. You must combine the columns into one (helper column) or switch to INDEX/MATCH or XLOOKUP.
Why does my VLOOKUP return the wrong value even though I have a helper column?
Check that the helper column is in the first column of the table_array. VLOOKUP always searches the first column. Also ensure the delimiter in the helper column matches exactly the delimiter in your lookup cell.
Does XLOOKUP work in Excel 2016?
No. XLOOKUP was introduced in Excel 2021 and Microsoft 365. For older versions, use INDEX/MATCH or a helper column.
How do I make a case-sensitive multiple criteria lookup?
Use an array formula with EXACT: =INDEX(C2:C10, MATCH(TRUE, EXACT(A2:A10,E2)*EXACT(B2:B10,F2), 0)). Press Ctrl+Shift+Enter in older Excel.
What if I need to return the last match instead of the first?
Use XLOOKUP with match_mode=-1: =XLOOKUP(1, (A:A=E2)*(B:B=F2), C:C, , -1). Or use LOOKUP(2,1/((A:A=E2)*(B:B=F2)),C:C) in any version.
Related
- How to Add Subtotals in Google Sheets
- How to Add Value to a Dictionary in Python
- Import Excel CSV to InfluxDB GUI: Step-by-Step
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Sort Excel by Color: Cells, Font Colors, and IconsTo sort Excel rows by color in Microsoft 365 for Windows, select your data, choose Data > Sort,…
- How to Filter Odd Numbers in Excel with a FormulaTo filter odd numbers in Excel, add a helper column with =IFERROR(AND(ISNUMBER(A2),MOD(A2,2)=1),FALSE), fill it down, then use Data…
- Excel Formula for Age From Date of BirthThe simplest Excel formula for age from a date of birth is =DATEDIF(A2,TODAY(),"Y"), assuming the birth date is…
- Text Formula Examples in Excel: Clean, Extract, CombineExcel text formulas let you combine words, extract part of a value, standardize capitalization, and clean imported text.…
- PySpark String Functions: Examples and Common UsesPySpark string functions are built-in column operations in pyspark.sql.functions for cleaning, transforming, searching, and parsing text in a…
- Excel Formula for Percentage Increase: Examples and TipsTo calculate percentage increase in Excel, subtract the old value from the new value, then divide by the…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.