An easy way to solve this problem is to use the SUMIFS function, as explained below.

SUMIFS function

TheSUMIFS functioncan sum values in ranges based on multiple criteria.

The references to F5 and G5 arerelativeand change at each new row.

Excel formula: Sum if greater than

  • Note: SUMIFS is in a group of functions that split criteria into two parts.

As a result, the syntax used for operators is different from other functions.See this article for details.

Excel formula: Sum if less than

Excel formula: Sum if begins with

Excel formula: Sum if not blank

Excel formula: Sum if cells are equal to

Excel formula: Sum if cells are not equal to

Excel formula: Sum if x or y

Excel formula: Sum if cells contain specific text

Excel SUMIFS function