How to Use SUMIFS with INDEX and MATCH for Duplicate Criteria in Excel
Question details
The user needs to sum all rows that match specific criteria, but standard INDEX and MATCH functions only return the first matching row.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Aggregating data from a large dataset where multiple rows share the same criteria and need to be summed dynamically based on column headers.
- Observed behavior
- Using INDEX and MATCH alone only retrieves the first matching instance, failing to combine all relevant rows.
Ensure your dataset has clear, unique column headers and that the criteria you are matching against are formatted consistently to avoid calculation errors.
Combine SUMIFS with INDEX and MATCH
Use a nested formula where MATCH finds the correct column, INDEX retrieves the entire column range, and SUMIFS calculates the total for all matching rows.
While INDEX and MATCH are excellent for looking up a single value, they stop at the first match. By nesting them inside a SUMIFS function, you can dynamically select a column based on its header and sum all rows that meet your specific criteria.
Determine the cell containing your column header criteria (e.g., C$1) and the row criteria (e.g., $A7). Identify your data range (e.g., 'Data'!$A$4:$AB$2158).
Use MATCH(C$1, 'Data'!$A$4:$AB$4, 0) to find the relative position of the column header you want to sum.
Wrap the MATCH function in INDEX to return the entire column: INDEX('Data'!$A$4:$AB$2158, 0, MATCH(...)). The 0 for the row argument tells INDEX to return the whole column.
Finally, use SUMIFS to sum the values in the dynamic column returned by INDEX, based on your row criteria: =SUMIFS(INDEX(...), 'Data'!$A$4:$A$2158, $A7).

Master Complex Formulas with WPS Spreadsheet
WPS Spreadsheet fully supports advanced nested functions like SUMIFS, INDEX, and MATCH, allowing you to analyze complex datasets with ease.
- 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your workbook containing the data.
- 2. Enter the nested formula: Select the target cell and input your =SUMIFS(INDEX(...), ...) formula.
- 3. Drag to fill: Use the fill handle to drag the formula across your summary table, ensuring absolute and relative references (like $A7 and C$1) are set correctly.

Frequently Asked Questions
Why does my INDEX and MATCH formula only return one value?
The standard INDEX and MATCH combination is designed to look up and return the first instance it finds. To aggregate or sum multiple matching instances, you must use a function like SUMIFS or SUMPRODUCT.
Can I use this formula with multiple criteria?
Yes. Because the outer function is SUMIFS, you can add additional criteria ranges and criteria to the end of the formula to filter the sum by multiple conditions.
What does the '0' do in the INDEX function?
In the formula INDEX(range, 0, column_num), the '0' in the row argument instructs the INDEX function to return the entire column array rather than a single cell. This array is then passed to SUMIFS as the sum range.
Will this formula slow down my spreadsheet?
While nested formulas are powerful, using them across tens of thousands of rows can impact performance. Ensure your referenced ranges are limited to the actual data size rather than referencing entire columns (e.g., A:A) to maintain optimal speed.




