How to Fix Invalid Cell Reference Errors in Excel SUMIF and INDEX Formulas
Question details
The user needs to resolve an invalid cell reference error that occurs when combining SUMIF/SUMIFS, INDEX, and MATCH functions to sum data dynamically.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Using a nested formula (SUMIF/SUMIFS, INDEX, and MATCH) to calculate sums dynamically across multiple columns, such as retrieving monthly totals based on purchase orders.
- Observed behavior
- The formula returns a #REF! or invalid cell reference error because the INDEX function is supplied with a one-column range, but the MATCH function passes a column index greater than 1.
Double-check your dataset to ensure that the array ranges in your formula are exactly identical in size, and verify that date headers and criteria are formatted consistently as either dates or text.
Expand the INDEX Array to Include All Target Columns
Adjust the INDEX range to include all columns so MATCH can correctly reference the desired column without returning an out-of-bounds error.
When combining INDEX and MATCH inside a SUMIF or SUMIFS function, a common mistake is providing a single-column range to INDEX (like $D$22:$D$30000) but asking MATCH to look for a specific column number. This forces Excel to look outside the defined array, triggering an invalid cell reference error.
Adjust the INDEX array in your formula bar to cover the entire multidimensional data grid containing the values you want to sum. For example, change it from $D$22:$D$30000 to $D$22:$F$30000.
Since SUMIFS evaluates entire columns, leave the INDEX row_num argument blank or enter a zero. It should look like this: INDEX($D$22:$F$30000, 0, ...)
Use the MATCH function to locate the correct column dynamically. Add MATCH($B12, $D$21:$F$21, 0) as the column_num argument inside your INDEX function.
Wrap the configured INDEX/MATCH formula inside your SUMIFS function, adding your criteria ranges. The final formula should look like: =SUMIFS(INDEX($D$22:$F$30000,,MATCH($B12,$D$21:$F$21,0)),$C$22:$C$30000,C$3,$A$22:$A$30000,$B$11). Press Enter to apply.

Use SUMIF with INDEX for Single-Criteria Summations
If you only need to evaluate a single condition before summing dynamically selected columns, a simplified SUMIF structure is easier to manage.
Effortlessly Manage Complex Formulas in WPS Spreadsheet
WPS Spreadsheet fully supports advanced array formulas, including SUMIFS, INDEX, and MATCH, with built-in intuitive formula auditing tools to help you pinpoint reference mistakes quickly.
- 1. Open your file in WPS Spreadsheet: Launch WPS Office and open your .xlsx workbook containing the problematic SUMIF and INDEX formulas.
- 2. Launch the Evaluate Formula tool: Navigate to the 'Formulas' tab on the top ribbon and click the 'Evaluate Formula' button to systematically step through your calculation execution.
- 3. Identify and correct the reference error: Watch the evaluation window to see exactly where the array size mismatch occurs. Once identified, adjust your INDEX range dimensions directly in the formula bar.

Frequently Asked Questions
Why does INDEX return an invalid cell reference when nested with MATCH?
This happens when the column number or row number provided by the MATCH function exceeds the dimensions of the array supplied to the INDEX function. For example, asking for column 3 in a 1-column array throws a #REF! error.
How do absolute and relative references affect INDEX/MATCH arrays?
Using absolute references (like $D$22:$F$30000) for your data arrays ensures they do not shift when the formula is copied. Mixed references (like C$3 or $B12) should be used for criteria that need to increment dynamically by row or column as you drag the formula.
Is SUMIFS better than SUMIF when using dynamic columns?
SUMIFS is generally preferred for modern spreadsheet tasks because it supports multiple criteria effortlessly and evaluates ranges more consistently when paired with complex nested arrays like INDEX and MATCH.




