Fix an Excel SUMPRODUCT Formula for Calculating Client Hours
Question details
The user needs to correct a complex Excel formula that fails when calculating working hours by client and month because the MATCH function cannot process a range as a single lookup value.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Calculating total hours categorized by specific clients and specific calendar months using multiple criteria.
- Observed behavior
- A complex formula combining SORT, UNIQUE, FILTER, SUM, IF, FREQUENCY, and MATCH returns an error because MATCH fails to process an entire range as a lookup value.
Ensure that your date, client name, and hours ranges (e.g., $A$4:$A$38) are exactly the same size before applying array-based formulas like SUMPRODUCT.
Use SUMPRODUCT with Double Unary Operators
Replace the complex MATCH formula with a streamlined SUMPRODUCT function that handles array evaluations efficiently.
The SUMPRODUCT function can easily process arrays with multiple conditions. By using the double unary operator (--), you can convert Boolean results (TRUE and FALSE) into numeric values (1 and 0).
This allows SUMPRODUCT to multiply these 1s and 0s against your data range, thereby only summing the hours that match both the specific month and the client.
Click on the cell where you want the calculated total client hours to appear.
Type the formula using the double unary operator for your criteria. For example: =SUMPRODUCT(--(MONTH($A$4:$A$38)=7),--($E$4:$E$38=H4),$D$4:$D$38)
Press Enter to calculate the result. The formula evaluates the arrays and returns the summed hours for month 7 and the client specified in cell H4.

Analyze Data Using a PivotTable
Reorganize your data using a PivotTable for an error-free, visual alternative to writing complex formulas.
Manage Complex Data and Formulas Easily with WPS Spreadsheet
WPS Spreadsheet fully supports advanced array formulas, including SUMPRODUCT, making it easy to accurately calculate hours by client and month. It provides an intuitive interface and powerful formula analysis tools to help you troubleshoot data errors instantly.
- 1. Open your workbook in WPS Spreadsheet: Launch WPS Office and open your existing spreadsheet containing the client hours data.
- 2. Apply the SUMPRODUCT formula: Click into the desired calculation cell and input your SUMPRODUCT formula with double unary operators just as you would in Excel.
- 3. Use formula auditing if needed: Navigate to the Formulas tab and select Evaluate Formula to verify that your Boolean arrays are correctly converting to 1s and 0s.

Frequently Asked Questions
What does the double dash (--) mean in an Excel formula?
The double dash, or double unary operator, is used to coerce Boolean values (TRUE or FALSE) into numeric values (1 or 0). The first dash converts TRUE to -1, and the second dash turns it into positive 1, allowing mathematical functions like SUMPRODUCT to use the results in calculations.
Why does my MATCH function return an error when using a range?
The MATCH function is strictly designed to look up a single value within a one-dimensional array. When you input an entire range as the lookup_value argument without wrapping it in an array formula wrapper, it cannot process the multiple values simultaneously and returns an error.
Are there other alternatives to SUMPRODUCT for multiple criteria?
Yes, you can also use the SUMIFS function to sum values based on multiple criteria. SUMIFS is often faster to calculate than SUMPRODUCT, but SUMPRODUCT offers more flexibility when you need to manipulate arrays, such as extracting the month from a date range directly inside the formula.




