Quick, clean, and to the point


Excel formula: SUMPRODUCT with IF
Generic formula 

To filter results of SUMPRODUCT with specific criteria, you can apply simple logical expressions directly to arrays in the function, instead of using the IF function. In the example shown, the formulas in H5:H7 are:


where the following named ranges are defined:


If you'd rather avoid named ranges, use the ranges above entered as absolute references. The logical expressions in H6 and H7 can be combined, as explained below.


This example illustrates one of the key strengths of the SUMPRODUCT function – the ability to filter data with basic logical expressions instead of the IF function. Inside SUMPRODUCT, the first array is a logical expression to filter on the color "red":


This results in an array or TRUE FALSE values, which are coerced into ones and zeros with the double negative (--) operation. The result is this array:


Notice the array contains 10 values, one for each row. A one indicates a row where the color is "red" and a zero indicates a row with any other color.

Next, we have two more arrays: one for quantity and one for price. Together with this results from the first array, we have:


Expanding the arrays, we have:


SUMPRODUCT's core behavior is to multiply, then sum arrays. Since we are working with three arrays, we can visualize the operation as shown in the table below, where the result column is the result of multiplying array1 * array2 * array3:

array1 array2 array3 result
1 10 15 150
0 6 18 0
1 14 15 210
0 9 16 0
0 11 18 0
0 10 18 0
1 8 15 120
0 9 16 0
0 11 18 0
0 10 16 0

Notice array1 works as a filter – zero values here "zero out" values in rows where the color is not "red". Putting the results back into SUMPRODUCT, we have:


Which returns a final result of 480.

Adding additional criteria

You can extend criteria by adding another logical expression. For example, to find total sales where the color is "Red" and the state is "TX", H6 contains:


Note: SUMPRODUCT is not case-sensitive.

Simplifying with a single array

Excel pros will often simplify the syntax inside SUMPRODUCT a bit by multiplying arrays directly inside array1 like this:


This works because the math operation (multiplication) automatically coerces the TRUE and FALSE values from the first two expressions into ones and zeros.

Dave Bruns

Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.

Download 100+ Important Excel Functions

Get over 100 Excel Functions you should know in one handy PDF.