Formula Errors

How to Fix SUMPRODUCT #REF! Errors in Excel When Retrieving Names

Adam DavisAdam Davis Oct 23, 2026 870 views

Question details

The user needs a way to prevent a SUMPRODUCT and INDEX formula combination from returning a #REF! error when searching for the most recent matching numeric value.

How to Fix SUMPRODUCT #REF! Errors When Retrieving Names in Excel
Product
Excel
Device & OS
not provided
Scenario
Extracting text associated with the last numeric row in a dataset using the INDEX and SUMPRODUCT functions, without triggering reference errors.
Observed behavior
The current formula returns a #REF! error, likely because it attempts to reference cells outside the valid range or beyond the current row's context.
Before you start

Verify that your data columns are correctly aligned and that no rows or columns referenced by your formula have been accidentally deleted.

Solution 1Recommended

Use an Expanding Range with INDEX and SUMPRODUCT

Adjust your formula to utilize an expanding range that correctly stops at the previous row, avoiding invalid references and the need for array entry.

A #REF! error in this scenario typically occurs when the formula attempts to evaluate rows dynamically but exceeds the available sheet references. By applying an expanding range (where the start is absolute and the end is relative), you force the formula to only look at rows preceding the current cell.

1
Select the target cell

Click on the cell in column A where you want the retrieved name to appear.

2
Enter the expanding range formula

Type the formula: =IF(LEFT($C2,5)="Happy",INDEX($C$1:$C1,SUMPRODUCT(MAX(ISNUMBER($B$1:$B1)*ROW($B$1:$B1)))),"") into the formula bar.

3
Apply the formula

Press Enter to confirm. Because SUMPRODUCT handles arrays natively, you do not need to press Ctrl+Shift+Enter.

4
Copy the formula down

Click and drag the fill handle at the bottom-right corner of the cell to apply the formula to the remaining rows in your table.

Use an Expanding Range with INDEX and SUMPRODUCT
Expanding Range Benefit: Using $C$1:$C1 dynamically expands as you drag it down (becoming $C$1:$C2, etc.), ensuring the reference always stays within valid boundaries.
Efficient Formula Processing

Fix Complex Formula Errors Instantly with WPS Office

WPS Spreadsheet seamlessly handles advanced array calculations like SUMPRODUCT and INDEX. With its intuitive error-checking tools, you can easily troubleshoot and resolve #REF! errors without modifying your familiar workflow.

  1. 1. Open your file in WPS Spreadsheet: Launch WPS Office and open the document containing the formula errors.
  2. 2. Locate the #REF! error: Select the cell displaying the error and look for the yellow warning icon next to it.
  3. 3. Trace the error: Click the warning icon and select 'Trace Error' to visually identify which cell reference is missing or invalid.
  4. 4. Apply the correct formula: Update the formula with the expanding range technique to safely retrieve your data.
Fully compatible with Microsoft Excel formulas and .xlsx filesBuilt-in error checking for tracing invalid referencesHandles complex array functions without performance dropsFree and lightweight alternative for powerful data analysis
microsoft office alternative - wps office

Frequently Asked Questions

What does a #REF! error mean in Excel?

A #REF! error stands for 'Reference'. It occurs when a formula refers to a cell that is not valid, most commonly because cells, columns, or rows were deleted, or a dynamic formula searched beyond the spreadsheet boundaries.

Why use SUMPRODUCT instead of standard array formulas?

SUMPRODUCT is designed to process arrays natively. Unlike older array formulas, you do not need to use the Ctrl+Shift+Enter shortcut, making it much easier to edit and share with other users.

How does an expanding range like $C$1:$C1 work?

The dollar signs make the start of the range absolute ($C$1), while the end remains relative ($C1). As you drag the formula down to row 2, it automatically updates to $C$1:$C2, allowing it to grow row by row without referencing future rows.