Smart Systems for Home

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

XLOOKUP with Multiple Lookup Values: A 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 can handle multiple lookup values by nesting it inside functions like FILTER or by using array constants, but the simplest working method is to use XLOOKUP with a concatenated helper column. This guide shows you exactly how to set that up, step by step, so you can look up a combination of values (for example, a product and a region) and return a single result.

What You'll Need

  • Microsoft Excel 365, Excel 2021, or later (XLOOKUP is not available in Excel 2019 or earlier).
  • A table with your data, including the columns you want to use as lookup values and the column you want to return.
  • Basic familiarity with Excel formulas and cell references.

Step-by-Step

  1. Identify your lookup columns and return column. For example, suppose you have a table with columns A (Product), B (Region), and C (Sales). You want to look up a specific Product and Region combination and return the Sales figure.
  2. Create a helper column for the combined lookup key. In a new column (say column D), enter a formula that concatenates the two lookup values with a delimiter. For row 2, type: =A2&"|"&B2. The pipe character | is a safe delimiter because it is unlikely to appear in your data. Copy this formula down for all rows. This column now holds a unique key for each row.
  3. Set up your lookup input cells. Somewhere else on the sheet (or another sheet), create two cells where you will type the values to look up. For example, cell F1 for Product and F2 for Region. Then create a third cell (F3) with the formula: =F1&"|"&F2. This is your lookup key.
  4. Write the XLOOKUP formula. In the cell where you want the result (say F4), enter: =XLOOKUP(F3, D2:D100, C2:C100, "Not found"). Here, F3 is the combined lookup key, D2:D100 is the helper column range, C2:C100 is the return range, and "Not found" is the optional if_not_found text. Adjust the ranges to match your data.
  5. Test with different combinations. Change the values in F1 and F2 and confirm that the result updates correctly. If a combination does not exist, the formula should return "Not found".
  6. Optional: avoid the helper column with an array formula. If you prefer not to add a helper column, you can use XLOOKUP with an array constant inside FILTER, but this is more advanced. For most users, the helper column method is clearer and easier to maintain. If you want to try the array approach, you can use: =XLOOKUP(1, (A2:A100=F1)*(B2:B100=F2), C2:C100, "Not found"). This works because the multiplication of the two conditions creates an array of 1s and 0s, and XLOOKUP finds the 1 where both conditions are true. Note that this requires Excel to handle arrays natively (Excel 365 does).

Common Mistakes

  • Forgetting to copy the helper formula down. If the helper column only has a formula in the first row, XLOOKUP will not find matches for other rows. Always fill the formula down to the last row of your data.
  • Using a delimiter that appears in your data. If your product names contain the pipe character, the concatenated key may become ambiguous. Choose a delimiter that does not appear in any of your lookup values, such as a tilde ~ or a combination like ||.
  • Mismatched ranges. The lookup array (helper column) and return array must be the same size. If one range is D2:D100 and the other is C2:C99, XLOOKUP will return a #VALUE! error.
  • Not locking ranges when copying the formula. If you plan to copy the XLOOKUP formula to other cells, use absolute references (e.g., $D$2:$D$100) for the helper and return ranges to prevent them from shifting.
  • Expecting XLOOKUP to accept multiple lookup values directly. XLOOKUP's lookup_value argument takes a single value. To look up multiple values, you must combine them into one key as shown, or use an array formula.

Tips

  • Use Excel Tables for dynamic ranges. If you convert your data to a table (select the range and press Ctrl+T), the helper column and XLOOKUP ranges will automatically expand as you add rows. This makes your solution more robust.
  • Name your ranges for readability. You can define names for the helper column and return column (Formulas > Define Name) and then use those names in the XLOOKUP formula, e.g., =XLOOKUP(F3, HelperKeys, SalesValues, "Not found").
  • Consider using SUMIFS for numeric returns. If you are summing multiple matches (e.g., total sales for a product and region), SUMIFS may be more appropriate than XLOOKUP, which returns only the first match.
  • Use the if_not_found argument to provide a clear message. Instead of letting XLOOKUP return #N/A, specify a custom text like "Combination not found" to make errors obvious.
  • For multiple criteria without helper columns, try the array formula approach. It is more compact but can be slower on very large datasets. Use it when you need a quick one-off solution.

Troubleshooting

If your XLOOKUP returns #N/A even though you believe the combination exists, check for these issues:

  • Extra spaces: Use the TRIM function on both the helper column and the lookup key to remove leading/trailing spaces. For example, change the helper formula to =TRIM(A2)&"|"&TRIM(B2) and the lookup key to =TRIM(F1)&"|"&TRIM(F2).
  • Data type mismatch: If one value is stored as text and the other as a number, the concatenation may produce different results. Ensure both are formatted consistently (e.g., both as text).
  • Case sensitivity: XLOOKUP is not case-sensitive by default. If you need case-sensitive matching, you can use the EXACT function inside an array formula, but that is advanced.
  • Helper column not updated: If you add new rows, the helper column formula may not have been copied down. Check that every row has a key.
  • Formula errors: If you see #VALUE!, check that the lookup array and return array are the same size. If you see #REF!, check that your ranges are valid.

If the array formula approach returns unexpected results, ensure that the conditions are enclosed in parentheses and that the multiplication is correct: (A2:A100=F1)*(B2:B100=F2). Also, confirm that the return range is the same size as the condition arrays.

Frequently Asked Questions

Can XLOOKUP handle more than two lookup values?

Yes. You can concatenate any number of values into a single key. For example, =A2&"|"&B2&"|"&C2 for three criteria. Just ensure the delimiter is consistent and does not appear in your data.

Do I need a helper column for multiple lookup values?

No, but it is the simplest and most reliable method. You can use an array formula with XLOOKUP and boolean logic, but that requires Excel 365 or Excel 2021 and can be harder to debug.

Why does my XLOOKUP return the wrong match?

This usually happens when the lookup key is not unique. If multiple rows have the same combined key, XLOOKUP returns the first match. To handle duplicates, consider using FILTER to return all matches or SUMIFS to aggregate.

Can I use XLOOKUP with wildcards for multiple values?

XLOOKUP supports wildcards (?, *, ~) in the lookup_value when the match_mode argument is set to 2. However, wildcards apply to a single text string, not to multiple separate values. For multiple criteria, stick to concatenation.

Is XLOOKUP available in Excel for Mac?

Yes, XLOOKUP is available in Excel for Microsoft 365 for Mac and Excel 2021 for Mac. It is not available in older versions.

What if my lookup values are in different columns but I want to return a value from a third column?

That is exactly the scenario this guide covers. Concatenate the two lookup columns into a helper column, concatenate your search values into a key, and use XLOOKUP with the helper column as the lookup array and the third column as the return array.