Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

XLOOKUP with Multiple Criteria: Excel How-To Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

XLOOKUP does not accept multiple criteria directly, but you can make it work by combining the criteria into a single lookup value with concatenation, or by nesting XLOOKUP inside another XLOOKUP. The concatenation method is the most reliable and easiest to audit: join the columns you want to match into one helper string, then look up that same string. This guide walks through the exact formulas, the common traps, and what to do when you get #N/A.

What You'll Need

  • Excel 365, Excel 2021, or Excel for the web (XLOOKUP is not available in Excel 2019 or earlier).
  • A table where the values you want to match sit in separate columns, and a return column with the result you want.
  • Basic familiarity with cell references and the ampersand (&) operator for joining text.

Step-by-Step

  1. Identify your criteria columns and return column. For example, suppose A2:A100 holds Region, B2:B100 holds Product, and C2:C100 holds Sales. You want the sales figure for a specific Region and Product combination.
  2. Decide where the criteria values live. Put the Region you are searching for in E2 and the Product in F2. Keeping them in cells rather than hard-coding them makes the formula reusable.
  3. Build the lookup array with concatenation. In the XLOOKUP formula, the lookup_array argument becomes A2:A100&B2:B100. This creates an in-memory array where each row is the Region and Product joined together, for example NorthWidget.
  4. Build the lookup value the same way. The lookup_value argument becomes E2&F2. The two strings must be constructed identically, or the match will fail.
  5. Write the full formula. In an empty cell enter:
    =XLOOKUP(E2&F2, A2:A100&B2:B100, C2:C100, "Not found")
    Press Enter. The formula returns the Sales value for the matching Region and Product.
  6. Test with a known combination. Type a Region and Product you can see in the data and confirm the returned value matches the source row. Then change one criterion and confirm the result updates.
  7. Add a not-found message. The fourth argument in the example above is the if_not_found value. Use a clear message such as "No match" instead of letting #N/A appear, which makes the sheet easier to read.
  8. Use a wildcard-free exact match. Leave the fifth argument (match_mode) at 0 for exact match. Do not set it to 2 (wildcard) when concatenating, because the joined string is treated literally.
  9. Optional: avoid helper columns entirely. The concatenation above happens inside the formula, so no helper column is required. If you prefer a helper column for auditing, add a column that joins the criteria, then point XLOOKUP at that single column.
  10. Optional: nested XLOOKUP alternative. If you cannot concatenate (for example, the criteria are numeric and formatting differs), use =XLOOKUP(E2, A2:A100, XLOOKUP(F2, B2:B100, C2:C100)). This works only when the inner lookup returns a range aligned row-for-row with the outer lookup; otherwise it returns the wrong row. The concatenation method is safer for most tables.

Common Mistakes

  • Mismatched join order. A2:A100&B2:B100 must be joined in the same order as E2&F2. Swapping one side produces no match.
  • Hidden spaces. A trailing space in either the source data or the criteria cell breaks the match. Use TRIM on both sides if the data is pasted from elsewhere: TRIM(E2)&TRIM(F2) and TRIM(A2:A100)&TRIM(B2:B100).
  • Number stored as text. If one criterion is numeric in the source but text in the criteria cell, the joined strings differ. Convert with VALUE or TEXT so both sides use the same type.
  • Different row counts. The lookup_array and return_array must be the same size. A2:A100&B2:B100 paired with C2:C99 returns a #VALUE! error.
  • Using match_mode 2 with concatenation. Wildcards apply to the whole joined string, not to individual criteria, which rarely behaves as intended.
  • Forgetting the if_not_found argument. Without it, a missing combination returns #N/A, which can cascade into other formulas.

Tips

  • Name your ranges (Formulas > Define Name) so the formula reads =XLOOKUP(E2&F2, RegionProd, Sales) instead of long cell references.
  • Use a delimiter that cannot appear in the data, such as a pipe character: A2:A100&"|"&B2:B100 and E2&"|"&F2. This prevents false matches when one value ends with text that another value begins with.
  • For three or more criteria, keep joining with the same delimiter on both sides; the pattern scales without changing the structure.
  • Convert the source range to an Excel Table (Ctrl+T) so the formula expands automatically as rows are added.
  • If you need the sum of all matches rather than the first match, use SUMIFS with the same criteria instead of XLOOKUP.

Troubleshooting

If the formula returns #N/A, first confirm the criteria cells contain exactly the values you expect, with no leading or trailing spaces. Click into the cell and check the formula bar. Next, test a single criterion with a plain XLOOKUP to confirm the column itself matches; if that works, the join is the problem. Compare the joined strings by putting =E2&F2 and =A2&B2 in two adjacent cells and checking whether they are identical character for character.

If you see #VALUE!, the lookup_array and return_array sizes differ. Select both ranges and confirm they start and end on the same rows. If the result is wrong but not an error, check that no duplicate combination exists earlier in the data; XLOOKUP returns the first match by default. Use the sixth argument (search_mode) set to -1 to search from the bottom if you need the last match.

If the formula works in one row but not when filled down, check whether the criteria references are locked. Use $E2&$F2 if the criteria columns should stay fixed while rows change, or E$2&F$2 if the criteria row should stay fixed while columns change.

If XLOOKUP is not recognised at all, the workbook is open in an older version of Excel. XLOOKUP requires Microsoft 365, Excel 2021, or Excel for the web. In older versions, use INDEX and MATCH with the same concatenation approach: =INDEX(C2:C100, MATCH(E2&F2, A2:A100&B2:B100, 0)) entered as a normal formula in modern Excel.

Frequently Asked Questions

Can XLOOKUP handle more than two criteria?

Yes. Join all criteria columns with the same delimiter on both the lookup side and the array side, for example A2:A100&"|"&B2:B100&"|"&D2:D100 matched against E2&"|"&F2&"|"&G2.

Why does my concatenated XLOOKUP return #N/A when the values look identical?

Usually a hidden space, a non-breaking space, or a number stored as text on one side. Wrap both sides in TRIM and confirm the data types match.

Do I need a helper column?

No. The concatenation happens inside the formula. A helper column is optional and only useful if you want to inspect the joined values while auditing the sheet.

Does XLOOKUP with multiple criteria work in Excel 2019?

No. XLOOKUP is not available in Excel 2019 or earlier. Use INDEX and MATCH with the same concatenation pattern instead.

What if there are duplicate matches?

XLOOKUP returns the first match by default. Set search_mode to -1 to return the last match, or use SUMIFS if you need to total all matching rows.

Can I use wildcards with multiple criteria?

Only with care. Wildcards apply to the whole joined string, so a wildcard in one criterion can match across the delimiter. For predictable results, use exact match and clean the data instead.