Use the combination of the SUMPRODUCT and SUMIF functions to sum values based on criteria of ‘if equals to many things’. In our example, we will set the criteria to sum product A and B.

**Formula:**

## How the formula works

In the above screenshot, the formulas used is:

=SUMPRODUCT(SUMIF(A4:A9,D4:D5,B4:B9))

where,

the SUMIF function is used against the argument of array1 in the SUMPRODUCT function:

and, in SUMIF(A4:A9,D4:D5,B4:B9)

**range** (A4:A9) – The range of cells that will be tested against the criteria.

**criteria** (D4:D5) – The criteria to be used to test on range e.g. sum if equal to product A and B.

**[sum_range]** (B4:B9) – The range of cells to be sum against the criteria.

**Result:**