Index Match with SUMIF: How to Combine Them

Formulas & functions · Updated November 23, 2026

The direct answer: there is no built-in function called “INDEX MATCH SUMIF” — you combine the INDEX and MATCH functions to find a row or column position, and then use SUMIF (or SUMIFS) to sum values that meet a condition in that located range. A typical formula looks like =SUMIF(INDEX(A2:E10,0,MATCH("North",A1:E1,0)),"Widget",INDEX(A2:E10,0,MATCH("North",A1:E1,0))) — but there are simpler ways to achieve the same result, and this article explains when and how to combine them.

Why Combine INDEX and MATCH with SUMIF?

Excel users often need to sum values that meet a condition, but the condition column isn’t fixed — it might be in a different column depending on which month or region is selected. SUMIF alone requires a fixed range for the criteria range and the sum range. INDEX and MATCH together can dynamically locate the correct column (or row) based on a header name, and then SUMIF can apply the condition to that dynamic range.

For example, you have a sales table with months as columns (Jan, Feb, Mar) and product names in column A. You want to sum all “Widget” sales for the month selected in cell G1. A fixed formula would be =SUMIF(A2:A100,"Widget",B2:B100) for January, but if you change the month, you need a different formula. Combining INDEX and MATCH lets you replace the fixed column with a dynamic one.

How INDEX and MATCH Work Together

INDEX(array, row_num, [column_num]) returns the value at a specific position in a range. MATCH(lookup_value, lookup_array, [match_type]) returns the position of a value in a range. Together, they can return a cell value, a row, or a column.

To return an entire column, you set the row_num to 0. For example, INDEX(B2:E100,0,2) returns the entire second column of the range B2:E100 (which is column C). That is the key trick: INDEX with a 0 row returns a whole column, and with a 0 column returns a whole row.

So to get the column for “March” in a table with headers in B1:E1, you use MATCH("March",B1:E1,0) which returns 3 (if B is the first column). Then INDEX(B2:E100,0,3) returns the entire March column. You can then feed that into SUMIF as the sum range.

Basic Example: Summing a Dynamic Column

Assume you have a table:

  • A1: “Product”, B1: “Jan”, C1: “Feb”, D1: “Mar”
  • A2:A10: product names (e.g., “Widget”, “Gadget”)
  • B2:D10: numeric sales values
  • G1: a month name like “Mar”

To sum all “Widget” sales for the month in G1, use:

=SUMIF(A2:A10,"Widget",INDEX(B2:D10,0,MATCH(G1,B1:D1,0)))

How it works: MATCH(G1,B1:D1,0) returns 3 for “Mar”. INDEX(B2:D10,0,3) returns the entire third column of B2:D10, which is D2:D10. SUMIF then sums values in D2:D10 where A2:A10 equals “Widget”.

If G1 contains “Feb”, MATCH returns 2, and INDEX returns C2:C10, so the formula sums the February column automatically.

Using SUMIFS with Multiple Criteria

If you need more than one condition, use SUMIFS instead. The syntax is SUMIFS(sum_range, criteria_range1, criteria1, ...). The sum range is the dynamic column from INDEX/MATCH, and the criteria ranges are other columns.

Example: same table, but you also have a “Region” column in column E. To sum “Widget” sales in “North” for the month in G1:

=SUMIFS(INDEX(B2:D10,0,MATCH(G1,B1:D1,0)),A2:A10,"Widget",E2:E10,"North")

This sums the dynamic month column where product is “Widget” and region is “North”. Note that the sum range and criteria ranges must be the same size; INDEX returns a column of 9 rows (rows 2 to 10), and the criteria ranges are also 9 rows, so they match.

When to Use INDEX+MATCH+SUMIF vs. SUMIFS with SUMPRODUCT

There is often a simpler alternative: SUMPRODUCT can handle dynamic columns without INDEX/MATCH. For example, the same result can be achieved with:

=SUMPRODUCT((A2:A10="Widget")*(B1:D1=G1)*B2:D10)

This multiplies two condition arrays and the data array, then sums the products. It works but can be slower on large datasets because it processes the whole 2D array. INDEX+MATCH+SUMIF only processes one column, so it is more efficient for big tables.

Use INDEX+MATCH+SUMIF when:

  • You have a large dataset (thousands of rows) and want performance.
  • You prefer the clarity of SUMIF/SUMIFS over SUMPRODUCT.
  • You are already familiar with INDEX/MATCH for lookups.

Use SUMPRODUCT when:

  • Your data is small (a few hundred rows) and you want a shorter formula.
  • You need to sum based on multiple conditions across rows and columns without helper columns.

Common Errors and How to Fix Them

Several mistakes trip up users when combining these functions:

  • #VALUE! error: Usually because the INDEX range and the criteria range in SUMIF are not the same size. For example, if your data is A2:D10, but your INDEX returns a column of 9 rows, your criteria range must be 9 rows too. Check that the row numbers match.
  • #N/A error: MATCH cannot find the lookup value. Ensure the header text in G1 matches exactly (including spaces) and that the match_type is 0 for exact match.
  • Wrong column returned: If your INDEX range does not start at the same column as your header range, the column number from MATCH will be off. For instance, if headers are in B1:D1 but your INDEX range starts at A2, then MATCH returns 1 for “Jan” but column 1 of A2:D10 is column A, not B. Always align the ranges: the header range should correspond to the columns in the INDEX range.
  • SUMIF with a whole column reference: Using INDEX(B:D,0,MATCH(...)) works but may include the header row. It’s safer to use a limited range like B2:D10.

Alternatives: SUMIFS with Helper Columns or SUMPRODUCT

If you find INDEX+MATCH+SUMIF confusing, consider these alternatives:

  • Helper column: Add a column that extracts the month name from the date or uses a formula to pick the right column, then use a simple SUMIF. For example, add a column F with =INDEX(B2:D2,MATCH($G$1,$B$1:$D$1,0)) for each row, then use =SUMIF(A2:A10,"Widget",F2:F10). This is easier to read but adds a helper column.
  • SUMPRODUCT: As shown earlier, =SUMPRODUCT((A2:A10="Widget")*(B1:D1=G1)*B2:D10) works without INDEX/MATCH. It is compact but less efficient on large data.
  • SUMIFS with a transposed table: If you restructure your data into a flat table (Product, Month, Sales), you can use a simple SUMIFS: =SUMIFS(C2:C100,A2:A100,"Widget",B2:B100,G1). This is the most straightforward approach and is recommended for new workbooks.

Frequently Asked Questions

Can I use INDEX and MATCH inside SUMIFS?

Yes, you can use INDEX/MATCH inside SUMIFS for the sum_range argument, as shown above. The criteria ranges can be regular columns. Just ensure all ranges have the same number of rows.

Does this work in Google Sheets?

Yes, INDEX, MATCH, SUMIF, and SUMIFS all exist in Google Sheets with the same syntax. The only difference is that in Google Sheets, you might use ARRAYFORMULA in some contexts, but for this combination, it works the same. In Excel for Mac, the functions are identical.

Why does my formula return 0 instead of a sum?

If the formula returns 0, check that the criteria text matches exactly (e.g., “Widget” vs “widget”). Also, ensure the values in the sum column are numbers, not text. Use the ISNUMBER function to test a cell.

Can I use a cell reference for the criteria instead of a hardcoded text?

Yes, replace “Widget” with a cell reference, e.g., =SUMIF(A2:A10,H1,INDEX(B2:D10,0,MATCH(G1,B1:D1,0))) where H1 contains the product name. This makes the formula dynamic.

Is there a way to sum based on both row and column conditions without INDEX/MATCH?

Yes, use SUMPRODUCT with multiple conditions, or restructure your data into a flat table and use SUMIFS. For example, =SUMPRODUCT((A2:A10="Widget")*(B1:D1=G1)*B2:D10) sums where both conditions are true.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.