To look up a value based on two columns in Excel, you cannot use a plain VLOOKUP with two lookup columns directly. Instead, you combine the two criteria into a single helper column (or use an array formula with INDEX/MATCH). The simplest method: insert a new column that concatenates the two lookup values (e.g., =A2&B2), then use VLOOKUP with the concatenated lookup value.
Why VLOOKUP Can’t Handle Two Columns Directly
VLOOKUP is designed to search for a single value in the first column of a table. It has no built-in mechanism to match two separate columns simultaneously. When you need to match on two criteria—say, a product code and a region—you’re effectively asking Excel to find a row where both conditions are true. VLOOKUP only checks one column, so it will return the first match for the first criterion, ignoring the second. This often leads to incorrect or ambiguous results.
The Helper Column Method (Easiest)
The most straightforward workaround is to create a helper column that concatenates the two lookup values into one string, then use that as the lookup column. Here’s how:
- Insert a new column to the left of your data (or anywhere, but the lookup column must be the first column of the table range).
- In the new column, enter a formula like
=A2&B2(assuming your two criteria are in columns A and B). Drag down to fill. - In your lookup cell, concatenate the two criteria you’re searching for:
=VLOOKUP(D2&E2, A:F, 6, FALSE)where D2 and E2 hold the criteria, and column F is the value to return.
For example, with product codes in A2:A100, regions in B2:B100, and sales in F2:F100, you’d create a helper column C with =A2&B2. Then to find sales for product “P123” in region “West”, use =VLOOKUP("P123"&"West", C:F, 4, FALSE). This returns the correct sales figure.
Using INDEX/MATCH for Two Criteria (No Helper)
If you prefer not to add a helper column, you can use an array formula with INDEX and MATCH. This method is more flexible and doesn’t alter your data layout. The formula is:
=INDEX(return_range, MATCH(1, (criteria1_range=criteria1) * (criteria2_range=criteria2), 0))
Assuming your criteria are in A2:A100 and B2:B100, and the return values are in F2:F100, with lookup values in D2 and E2, you’d enter:
=INDEX(F2:F100, MATCH(1, (A2:A100=D2) * (B2:B100=E2), 0))
This is an array formula, so in Excel 365 it works normally, but in older versions you must press Ctrl+Shift+Enter. The (A2:A100=D2) part returns an array of TRUE/FALSE, multiplying them together gives 1 only when both are TRUE, and MATCH finds that position.
Choosing Between VLOOKUP Helper and INDEX/MATCH
Which method should you use? Consider your situation:
- Helper column: Easier for beginners, works with VLOOKUP, but adds a visible column and requires maintenance if your data changes.
- INDEX/MATCH: No helper needed, more flexible (can look up to the left), and doesn’t require sorting. However, the array formula can be intimidating and may slow down on very large datasets.
- XLOOKUP (Excel 2021/365): If you have a recent version, XLOOKUP can handle multiple criteria natively using the
&operator in both lookup and return arrays:=XLOOKUP(D2&E2, A2:A100&B2:B100, F2:F100). This is the cleanest solution if available.
Common Pitfalls and How to Avoid Them
Several issues often trip users up when doing two-column lookups:
- Mismatched data types: Concatenating numbers and text can cause mismatches. For example,
123and"123"look the same but concatenate differently if one is a number. UseTEXT(A2,"0")to normalize. - Leading/trailing spaces: Extra spaces in cells break matches. Use
TRIM()in the helper column or in the lookup value. - Duplicate combined values: If two rows have the same combination, VLOOKUP returns the first. INDEX/MATCH also returns the first. Ensure your combination is unique.
- Case sensitivity: VLOOKUP and INDEX/MATCH are case-insensitive by default. If case matters, use
EXACT()in an array formula.
Real-World Example with Steps
Let’s say you have a sales table with columns: A (Product ID), B (Region), C (Salesperson), D (Units Sold). You want to find the salesperson for a specific product and region.
- Add a helper column E:
=A2&B2. - In a cell, enter the product ID (e.g., “PRD-100”) in G1 and region (“East”) in G2.
- Use the formula:
=VLOOKUP(G1&G2, A:E, 3, FALSE)to return the salesperson from column C.
If you don’t want the helper, use: =INDEX(C2:C100, MATCH(1, (A2:A100=G1)*(B2:B100=G2), 0)) and press Ctrl+Shift+Enter in older Excel.
Frequently Asked Questions
Can I use VLOOKUP with two columns without a helper?
No, VLOOKUP itself cannot handle two columns. You must either create a helper column or switch to INDEX/MATCH or XLOOKUP.
Does XLOOKUP work for two columns?
Yes, XLOOKUP can handle multiple criteria by concatenating the lookup values and the lookup arrays. For example: =XLOOKUP(F1&F2, A:A&B:B, C:C). This works in Excel 2021 and Microsoft 365.
Why does my VLOOKUP return #N/A even though the data looks correct?
This often happens because of formatting differences, like numbers stored as text, or extra spaces. Use TRIM() and TEXT() to clean your data, and ensure the concatenated strings match exactly.
Is there a way to do this without altering my spreadsheet?
Yes, use INDEX/MATCH with array formulas, or XLOOKUP if available. Both avoid adding a helper column.
Can I use this method in Google Sheets?
Yes, the same helper column and INDEX/MATCH methods work in Google Sheets. XLOOKUP is also available in Google Sheets as of 2022.
Alternatives to VLOOKUP for Two-Column Lookups
Besides the methods above, consider these options:
- Power Query: Merge queries based on multiple columns. This is great for large datasets and doesn’t require formulas.
- SUMPRODUCT: Can return a value by summing with conditions, but only works for numeric results.
- Dynamic Array Formulas: In Excel 365,
FILTERcan return all matching rows:=FILTER(C2:C100, (A2:A100=G1)*(B2:B100=G2)).
Each alternative has its strengths, so choose based on your data size and whether you need a single value or multiple matches.
Related
- Kindergarten Progress Report Template: What to Include
- What Speed Do Speed Cameras Catch You At?
- Conditional Format Every Other Row in Excel
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Product of Sums Formula: Boolean Algebra ExplainedThe product of sums (POS) formula is a way to write a Boolean expression as a product (AND)…
- Sort Excel Rows by Column Value: A Practical GuideTo sort rows in Excel by a column value, click a cell in the data, then choose Data…
- GameMaker String Functions: A Practical GML GuideGameMaker string functions let you create, inspect, search, edit, split, and format text in GML. The essentials include…
- Split Cells in Excel: Text to Columns and FormulasTo split text stored in one Excel cell into separate columns, use Data > Text to Columns on…
- Excel PV Formula for Different PaymentsExcel’s PV function is designed for a fixed payment repeated over a set number of periods, so it…
- Outlook Folders and Rules: Create a Folder and Sort EmailTo sort Outlook email automatically, create a folder, then make a rule that moves messages matching a condition—such…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.