Excel Functions for Looking Up Values by Two Conditions

VLOOKUP can only look up a value using one key in the first column. This article introduces four formula approaches for finding a value based on two conditions, including INDEX+MATCH, XLOOKUP, a helper-column concatenation, and SUMIFS, and explains the Excel versions each one suits and how to check the results.

Key points of this article

  • VLOOKUP can only look up by a single key. When matching two conditions at once, the common options are the INDEX+MATCH array formula, the XLOOKUP array formula, or first concatenating the keys in a helper column.
  • Older versions of Excel do not have XLOOKUP, and the INDEX+MATCH array formula in those versions must be confirmed with Ctrl+Shift+Enter.
  • The helper-column concatenation approach is compatible with all common versions and suits tables that are searched repeatedly or contain a large amount of data.
  • When a lookup returns no result, three common causes are inconsistent text and number formats, extra spaces, and duplicate records.
  • When you only need to sum or count, SUMIFS and COUNTIFS are more direct than lookup functions.

When looking up data in Excel, VLOOKUP is the most common choice. However, VLOOKUP can only use the leftmost column of the lookup range as the key, and it can only match on a single key to return a value. If you want to find "Zhang San's sales in March," which must satisfy both the name and the month conditions, VLOOKUP cannot do this directly. Many people can only filter manually or add a helper column to the table before looking up the value.

This article is for people who need to look up values in a detail table based on two conditions, for example: look up an amount by "department + date," look up a score by "student ID + subject," or look up a unit price by "customer + product." After reading it, you will be able to decide which approach to use, adapt the formulas to your own tables, and know how to troubleshoot when a lookup returns nothing.

The example below assumes the data is in column A (name), column B (month), and column C (sales), with data starting from row 2. If your table's columns are in a different position, just replace the column letters referenced.

How do I use functions in Excel to look up a value that meets two conditions at once? One-sentence answer

To look up by two criteria, the most versatile approach is the INDEX+MATCH array formula. If your Excel is a newer version, XLOOKUP is more concise. If the table needs to be maintained over the long term, add a helper column that combines the two criteria into a single key, which makes checking easier.

Your situationRecommended PracticesCause
The version is old, or you're not sure whether the newer functions can be used.INDEX+MATCH array syntaxAll common versions support it, but older versions require pressing Ctrl+Shift+Enter to confirm.
Use the newer version, and keep it short.XLOOKUP Multiple-Criteria SyntaxOne function that handles the lookup and also lets you set the text to return when nothing is found
Tables are updated frequently, so they need to be easy to verify.Helper column concatenates keywordsKeywords on every line should be visible, so that when something goes wrong you can spot it at a glance.
Only summing or counting is needed; there is no need to extract the specific values.SUMIFS or COUNTIFSDirectly supports multiple conditions, no need to handle arrays.
There are multiple records that satisfy the conditions at the same time, and all of them need to be listed.FILTER functionAble to return all matching rows at once; requires a newer version.

Before You Begin: Confirm These Points

Check your Excel version first. XLOOKUP and FILTER are only available in newer versions; opening them in an older version will show a function name error. When you are unsure of the version, prefer INDEX+MATCH, which has better compatibility.

Confirm whether both conditions are exact matches. To look up text such as "Zhang San" or "March," use exact matching. If you need a range condition such as "greater than a certain date," these formulas cannot be applied directly; instead, use SUMIFS or FILTER.

Check that the data formats are consistent. They all look like "3", but some may be the number 3 and others the text "3". When text and numbers are mixed, formulas will fail to find a match. Before you look up values, select a column and check the status bar or the format settings to confirm that they are all the same type.

Confirm that only one record meets all the conditions. If "Zhang San + March" appears twice in the table, INDEX+MATCH and XLOOKUP will only return the first one that appears. In this case, you should first remove the duplicates, or use FILTER to list all the matching records.

Decide in advance what to display when a lookup finds nothing. When a lookup fails, the formula returns an error value. You can use IFERROR, or the built-in argument of XLOOKUP, to replace the error with "Not found" or leave the cell blank. This makes later summaries easier and keeps error values from spreading to other cells.

Steps to Look Up a Value by Two Criteria Using INDEX+MATCH

  1. In a blank cell, type the start of the formula =INDEX(C2:C100,, where C2:C100 is the range you want to return values from.
  2. Next, type MATCH(1,, which finds the position that satisfies both conditions at the same time.
  3. Type the test for the first condition (A2:A100="张三"). Make sure the text inside the double quotes matches the table exactly.
  4. Connect the second condition with a multiplication sign *(B2:B100="3 月"). The result is 1 when both conditions are true, and 0 otherwise.
  5. Complete the third argument of MATCH ,0), which means exact match, then add the closing parenthesis for INDEX.
  6. In older versions of Excel, press Ctrl+Shift+Enter to confirm after typing the formula. Curly braces will appear on both sides of the formula. In newer versions, just press Enter.
  7. Replace "Zhang San" and "March" in the conditions with cell references, such as $F$2 and $G$2. This way, you only need to change two cells when you want to look up something different.
  8. Fill the formula down and check whether the results in several rows match the original table.

Verify each item after completion

After you find the results, don't use them directly. First, check them against the table below.

Checklist itemsHow do you see it?What should I do if I have a problem?
Is the return value correct?Manually find one or two records in the original table that satisfy both conditions, then compare the amounts or content.Check whether the column ranges in the formula match the number of rows in the condition ranges, for example both running from row 2 to row 100.
Does #N/A appear?Check whether the result cell displays #N/AThe message says no record meets the conditions at the same time. Check spelling, spaces, and format, or wrap it in IFERROR.
Are there any extra spaces?Check whether there are spaces before or after the text in the formula barUse the TRIM function to clean the original data, or apply TRIM to the criteria cells within your formulas.
Are there duplicate records?Use filtering or conditional formatting to check whether key combinations appear more than onceFirst delete or merge the duplicate rows, otherwise only the one that comes first will be returned.
Is the area range sufficient?Check whether the newly added data exceeds the number of rows referenced by the formulaSwitch to whole-column references, such as C:C, but note that whole-column references slightly increase the calculation load.

📊 Core Comparison

Writing styleApplicable versionsStrengthsNotes
INDEX+MATCH arrayCommon versionsGood compatibility, does not rely on newer functionsThe old version requires pressing Ctrl+Shift+Enter, and the formula is quite long.
XLOOKUP multiple criteriaNewer versionConcise style, and you can set the return value directly for when nothing is found.The older version doesn't have this function, and it likewise requires array operations.
Helper column concatenationCommon versionsKeywords are intuitive, making them easy to check and reuse.Need to add a column; it must be kept in sync when the source data changes
SUMIFS2007 and later versionsSupports multi-condition summation without the need for arrays.Only numerical values can be aggregated; textual content cannot be extracted.

❓ Frequently Asked Questions (FAQ)

1. Can VLOOKUP look up by two criteria directly?

It can't be done directly. VLOOKUP only looks at the key column of the lookup range. A common workaround is to first use a helper column to combine the two conditions, then use VLOOKUP or INDEX+MATCH to look up the combined key.

2. How do I write the helper column?

Assuming names are in column A and months are in column B, enter =A2&"|"&B2 in column D to get a key like "Zhang San|Month 3". Then use =INDEX(C:C,MATCH("张三|3 月",D:D,0)) to look up the key and retrieve the corresponding value from column C. The separator can be replaced with any other symbol that does not appear in the data.

3. The formula clearly refers to data, yet it shows #N/A. Why?

Common causes are hidden spaces in the data, or text and numbers formatted differently. You can first use TRIM to clean up the spaces, then check whether the formats are consistent. If there really is no matching record, #N/A is the normal result, and you can use IFERROR to display "Not found".

4. Multiple records meet the condition at the same time—how do I list all of them?

In this situation, INDEX+MATCH or XLOOKUP can only return the first matching record. If your version supports FILTER, you can use =FILTER(C2:C100,(A2:A100="张三")*(B2:B100="3 月")) to list all results at once. In older versions, you can first use the filter feature to view all the records, then organize them manually.

5. What should I do if the data was copied from a web page or other software and no results are found?

Data copied from other sources often contains invisible spaces or line breaks, and numbers may have been stored as text. You can first clean it with TRIM and CLEAN, then use the "Text to Columns" feature to standardize the format. If the data comes from a PDF, you also need to check whether the conversion was correct, and compare important figures item by item with the original file.

📝 Summary

Looking up a value that meets two conditions comes down to combining the two conditions into a single test. Older Excel versions are best served by INDEX+MATCH, newer versions can use XLOOKUP, and when you need to recheck the data over time, a helper column works well. After writing the formula, first verify it by hand with a few records, then check formatting, extra spaces, and duplicate entries, so you can rely on the results of formulas for looking up values that satisfy two conditions in Excel.

Open OmniDoc and process your spreadsheet file

Updated 2026-11-29