How to Convert SUMIF to SUMPRODUCT for Closed Workbooks
Question details
The user needs to replace a SUMIF formula with SUMPRODUCT to resolve a #VALUE! error that occurs when linking to external closed workbooks, utilizing a dynamic cell reference for the criteria.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Calculating conditional sums using data from an external workbook that might not be open at the time of calculation, utilizing a specific cell (like A4) as the dynamic criteria.
- Observed behavior
- The standard SUMIF function returns a #VALUE! error because it cannot process conditional ranges from an external workbook while that workbook remains closed.
Before modifying your formulas, ensure that the file paths, worksheet names, and data ranges in your external workbooks are completely accurate and that you have permission to access the referenced files.
Replace SUMIF with a SUMPRODUCT Array Formula
By structuring the SUMPRODUCT function as an array multiplier, you can bypass the closed-workbook limitation of SUMIF and calculate conditional sums without encountering the #VALUE! error.
The SUMPRODUCT function natively handles arrays and does not require external workbooks to remain open. By wrapping your criteria range in a boolean expression and multiplying it by the sum range, you instruct the software to calculate the data precisely like a SUMIF function, but with better external link support.
Select the cell displaying the #VALUE! error. Note the three components of your original formula: the criteria range, the criteria itself (e.g., cell A4), and the sum range.
Construct the first part of your SUMPRODUCT formula by wrapping the external criteria range and your criteria cell in parentheses. For example, type: (['C:\Documents\Sales.xlsx]Sheet1'!$A$2:$A$100=A4).
Add an asterisk (*) to act as the multiplier (which serves as an AND operator for arrays), followed by the external sum range wrapped in parentheses. Your combined structure should look like: (['C:\Documents\Sales.xlsx]Sheet1'!$A$2:$A$100=A4)*(['C:\Documents\Sales.xlsx]Sheet1'!$B$2:$B$100).
Wrap the entire expression within the SUMPRODUCT function so the final formula reads: =SUMPRODUCT((['C:\Documents\Sales.xlsx]Sheet1'!$A$2:$A$100=A4)*(['C:\Documents\Sales.xlsx]Sheet1'!$B$2:$B$100)). Press Enter to apply.

Manage Complex Array Formulas Seamlessly with WPS Spreadsheet
WPS Spreadsheet provides powerful support for advanced array functions, including SUMPRODUCT and multi-workbook linking. Troubleshoot formula errors effortlessly and maintain high performance, even when manipulating data across multiple closed files.
- 1. Open your workbooks in WPS Spreadsheet: Launch WPS Office and open your primary workbook. If you need to establish new links, temporarily open the external workbooks in separate tabs.
- 2. Input your SUMPRODUCT formula: Select the target cell, type =SUMPRODUCT(, and click through the tabs to intuitively select your external criteria and sum ranges without manually typing file paths.
- 3. Utilize the Evaluate Formula tool: If you encounter unexpected results, navigate to the Formulas tab and click 'Evaluate Formula'. This feature breaks down your array calculations step-by-step to pinpoint the exact source of a mismatch.

Frequently Asked Questions
Why does SUMIF return a #VALUE! error when referencing external workbooks?
The SUMIF, SUMIFS, COUNTIF, and COUNTIFS functions are designed in a way that requires the linked external workbook to be open in the background. When the source file is closed, the application cannot evaluate the conditional ranges, directly resulting in a #VALUE! error.
Can I convert a SUMIFS formula with multiple criteria to SUMPRODUCT?
Yes. You can replicate SUMIFS by multiplying additional array criteria within the SUMPRODUCT function. For example: =SUMPRODUCT((Range1=A4)*(Range2="Completed")*(SumRange)). This handles multiple conditions seamlessly even when the external files are closed.
Why is my SUMPRODUCT formula returning a #N/A error?
A #N/A error in SUMPRODUCT typically indicates that the arrays (ranges) you are multiplying do not share identical dimensions. Verify your external references to ensure every range covers the exact same number of rows and columns.
Does using SUMPRODUCT for closed workbooks slow down calculation speed?
Because SUMPRODUCT calculates arrays entirely in memory, applying it over massive datasets (like referencing entire columns such as A:A) can increase calculation time. To optimize performance, reference specific, restricted ranges (e.g., A2:A5000) instead of full columns.




