SUMIF and SUMIFS – Adds Cell Values that Meet Specified Criteria


The SUMIF function is used for summing a range of values provided that they meet a condition that you specify in the criteria argument. The SUMIF function only works if you are baseing your summing on a single criterion. If you need to base it on more than one criterion you will need to use the SUMIFS function.

The Syntax for the SUMIF function is:
SUMIF(range, criteria, [sum_range])

Argument Descriptions:
Range is the cells that you are baseing your criterion on. The range contains the values that will be checked by the criteria to determine if they are to be included in the sum.
Criteria is the condition that must be met if a value is to be included in the sum. If the condition contains any text, logical or mathematical symbols it must be enclosed in double quotation marks. Quotation marks are not necessary if the criterion is just a number.
Sum_Range is optional. If this optional range is used then it will be this range that contains the cells to be summed rather than the range in the first argument. The criteria will still be based on the first range argument.

The figure below contains a range of values that need to be summed, but we only want to sum those items whose value is greater than 900. There are only two values greater than 900 in the range B1:B6; they are 1100 and 1500.
Range of values used in SUMIF

The arguments used in the formula for summing the values greater than 900 are:
The complete formula is  =SUMIF(B1:B6,">900")
Placing the formula in cell B7 displays 2600 which is the result of adding 1100 + 1500. Sum of Values greater than 900

This figure shows a list of items and their prices. We only want to sum those items whose price is exactly 99 cents.  The formula entered into cell B10 is   =SUMIF(B2:B8,0.99).   Since we are only summing those values which are exactly .99 there is no need for any additional logical symbols because the equal sign is optional.  Because the criterion is only a number it does not need to be placed within double quotes. list of items to summed

Using the Optional Sum_Range

When using the optional Sum_Range argument you base your criteria on a different range of cells than those that you are summing.

We want to find the total number of males and females in a high school. The figure below shows the worksheet for this. The worksheet uses separate formulas for determining the number of males and females. The arguments used in the formula for determining the number of males are:

The formula entered in cell C11 is =SUMIF(B2:B9,"M",C2:C9) The only difference in the formula for computing females is the criteria which is “F”. The formula entered in cell C12 is =SUMIF(B2:B9,"F",C2:C9)

Result of using Criteria to determine Male or Female

Use SUMIF to sum items that meet one of multiple conditions


You have just seen how SUMIF can be easily used to sum only male or only female students,  but what if you wanted to know the total number of Freshman and Juniors.  You can test a single field for more than one criteria by using an array.  The Array is a list of the criteria values.  These values are enclosed within curly brackets { }.  Since we want to count students from the Freshman and Junior classes, these values will be our Criteria and we will enclose each one within quotation marks separated by a comma.  When using an array within the SUMIF funtion, the SUMIF function must be enclosed within a SUM function.

SUMIF used for summing multiple conditions in a single field

The arguments used in the formula for determining the number of Freshman and Junior class members are:

SUMIFS - Adds the Cells that Meet Multple Criteria


The SUMIFS function adds the Cells that Meet Multiple Criteria.  The SUMIFS function is similar to the SUMIF function except that the SUMIFS function is used to sum values only if multiple conditions are met rather than a single condition.
The Syntax for the SUMIFS function is:
SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, Criteria2]…)

Argument Descriptions
Sum_Range is the cells that you are basing your criterion on. The range contains the values that will be checked by the criteria to determine if they are to be included in the sum.
Criteria_range1 is the first range in which to evaluate the associated criteria .
Criteria1 is the condition that defines which cells in the criteria_range1 argument will be added. Criteria_range2, Criteria2,… You can add as many as 126 additional ranges and their associated criteria.

The figure below shows a company’s bank deposits along with the date of each deposit for its different branches. We want to sum the bank deposits in column B for those that meet the following conditions.

Spreadsheet that contains values that are to be used for the SUMIF function

The formula that will add the deposits that meet our criteria is:
=SUMIFS(B2:B11,A2:A11,"<>Hobart",B2:B11,">=20000",C2:C11,">=03/01/2010")

The following gives a break down of the SUMIFS function:

The rows that meet all the criteria are highlighted in the worksheet below. They are the only deposits that meet all three criteria of (1) Not being a Hobart branch, (2) Having a deposit greater than or equal to 20000 and (3) deposited on or after 3/12/2010. The result of adding the deposit for these three rows is 83562.79

Applied SUMIF function