keepcalculator

06 Numbers and Powers

Index Match on Multiple Columns: How-To Guide

Card No. 06·68872 · Updated · Standard formula, shown below

The calculator on this card is switched off while it is checked. The formula is below, and the worked example shows how to do the sum by hand.

Index and match on multiple columns lets you look up a value using two or more criteria in Excel or Google Sheets, returning a result from another column. You enter the lookup values and the ranges, and the formula finds the row where all conditions are true. This guide explains the formulas, how to build them, and common pitfalls.

Background: Why Use INDEX and MATCH?

VLOOKUP is the classic lookup function, but it has a major limitation: it can only search the first column of a table and return a value to the right. When you need to match on two or more columns, VLOOKUP fails. INDEX and MATCH combine to create a flexible lookup that works in any direction and supports multiple criteria. This combination has been a standard tool in Excel and Google Sheets for years, and it remains relevant even with newer functions like XLOOKUP.

How the INDEX and MATCH Combo Works

The core idea is to use MATCH to find the position of a value in a row or column, then use INDEX to return the value at that position. For multiple columns, you create a helper column that concatenates the criteria, or you use array formulas. The most common approach is the helper column method:

  • Add a new column (e.g., column A) that combines the two criteria, like =B2&"-"&C2.
  • Use MATCH to find the position of the combined criteria in that helper column.
  • Use INDEX to return the value from the desired column at that position.

For example, if you have a table with Product ID in column B, Region in column C, and Sales in column D, you would add a helper column A with =B2&"-"&C2. Then the formula to find Sales is:

=INDEX(D:D, MATCH(F1&"-"&F2, A:A, 0))

where F1 and F2 are the criteria cells.

Alternative: Array Formula without Helper Column

If you prefer not to add a helper column, you can use an array formula. In Excel, you enter it with Ctrl+Shift+Enter (in older versions) or just Enter in Excel 365. The formula looks like:

=INDEX(D:D, MATCH(1, (B:B=F1)*(C:C=F2), 0))

This works by multiplying the boolean arrays (TRUE/FALSE) to get 1 only when both conditions are true, then MATCH finds that 1. In Google Sheets, you can wrap it with ARRAYFORMULA or use the same syntax with Enter.

How to Choose the Right Method

Your choice depends on your version and preference:

  • Helper column: Works in all versions, easy to understand, but adds a column to your data.
  • Array formula: No extra column, but requires Ctrl+Shift+Enter in older Excel and can be slower on large datasets.
  • XLOOKUP: If you have Excel 365 or Google Sheets, XLOOKUP can handle multiple criteria natively with the syntax =XLOOKUP(1, (B:B=F1)*(C:C=F2), D:D).
  • SUMPRODUCT: For numeric returns only, you can use =SUMPRODUCT((B:B=F1)*(C:C=F2)*D:D), but it sums all matches, so it only works if the combination is unique.

Common Problems and How to Fix Them

Here are frequent issues and their solutions:

  • #N/A error: The combination of criteria is not found. Check for extra spaces or inconsistent formatting (e.g., text vs number).
  • #VALUE! error: The array formula wasn’t entered correctly. In older Excel, press Ctrl+Shift+Enter.
  • Duplicate matches: If the criteria combination appears more than once, MATCH returns the first occurrence. Ensure your data is unique or use a different method.
  • Case sensitivity: MATCH is case-insensitive by default. If you need case-sensitive, use EXACT in an array formula.
  • Performance: On large datasets, array formulas can slow down. Use helper columns or XLOOKUP for better speed.

Comparing INDEX/MATCH with XLOOKUP and SUMPRODUCT

XLOOKUP is the modern replacement, introduced in Excel 365. It simplifies multiple criteria lookups and doesn’t require Ctrl+Shift+Enter. SUMPRODUCT is useful when you need to sum all matching values, but it’s not a true lookup. INDEX/MATCH remains valuable for compatibility with older versions and for users who prefer the classic approach.

Frequently Asked Questions

Can I use INDEX and MATCH with three or more columns?

Yes, you can extend the same logic. For a helper column, concatenate all criteria: =B2&"-"&C2&"-"&D2. For an array formula, multiply all boolean arrays: =INDEX(E:E, MATCH(1, (B:B=F1)*(C:C=F2)*(D:D=F3), 0)).

How do I handle text and numbers in the same lookup?

Make sure the criteria cells are formatted consistently with the data. Use TEXT functions if needed, like =TEXT(B2,"0")&"-"&C2 to force numbers to text.

What if my data has blank cells?

Blank cells can cause false matches. Use IFERROR to handle errors, or clean the data by replacing blanks with a placeholder.

Does this work in Google Sheets?

Yes, the same formulas work in Google Sheets. For array formulas, you may need to wrap them with ARRAYFORMULA, but the syntax is identical.

Can I use wildcards with MATCH?

Yes, MATCH supports wildcards (* and ?) when the lookup value is text and match_type is 0. For example, =MATCH("*East*", C:C, 0) finds the first cell containing “East”.

Why is my formula returning the wrong value?

Check that your ranges are aligned. The INDEX range must be the same height as the MATCH range. Also, verify that the criteria are entered correctly and that there are no hidden characters.

Final Tips for Reliable Lookups

Always test with a known value. Use absolute references (e.g., $B$2:$B$100) to avoid errors when copying formulas. Consider using named ranges for clarity. And remember, the helper column method is often easier to debug than array formulas, especially for beginners.

Related

Formula used
in lookup_val1 | First criterion | - | 102 | 0
in lookup_val2 | Second criterion | - | "East" | 0
sel method | Method | INDEX/MATCH=1, XLOOKUP=2, SUMPRODUCT=3 | 1
out result | Lookup result | - | (lookup_val1 * 0 + lookup_val2 * 0) + 0 * sqrt(max(0, lookup_val1 - 0)) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →