In this example, SUMPRODUCT is configured with two arrays. The first array is the range that holds product pricing: Note the reference is absolute to prevent changes as the formula is copied to the right. This range evaluates to the following array: The second array is generated with this expression: The result of D5:D9=“x” is an array of TRUE FALSE values like this: The double negative (–) converts these TRUE FALSE values to 1s and 0s: So, inside SUMPRODUCT we have: The SUMPRODUCT function then multiplies corresponding items in each array together: and returns the sum of products, 168 in this case. Effectively, the second array acts as a filter for the values in the first array. Zeros in array2 cancel out items in array1, and 1s in array2 allow values from array1 to pass through into the final result.
With a single array
SUMPRODUCT is set up to accept multiple arrays, but you can simplify this formula a bit by providing a single array at the start: The math operation (multiplication) automatically coerces the TRUE FALSE values in the second expression to ones and zeros, with no need for a double negative.
Dave Bruns
Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.