What function should be used when adding the cells specified by the condition or criteria?

The SUMIF function returns the sum of cells in a range that meet a single condition. The first argument is the range to apply criteria to, the second argument is the criteria, and the last argument is the range containing values to sum. SUMIF supports logical operators (>,<,<>,=) and wildcards (*,?) for partial matching.  Criteria can use a value in another cell, as explained below.

SUMIF is in a group of eight functions in Excel that split logical criteria into two parts (range + criteria). As a result, the syntax used to construct criteria is different, and SUMIF requires a cell range for the range argument, you can't use an array.

SUMIF only supports a single condition. If you need to apply multiple criteria, use the SUMIFS function. If you need to manipulate values that appear in the range argument (i.e. extract the year from dates to use in criteria) see the SUMPRODUCT and/or FILTER functions.

Basic Usage | Criteria in another cell | Not equal to | Blank cells | Dates | Wildcards |  Videos

Basic usage

The general pattern for SUMIF is:

=SUMIF(range,criteria,sum_range) 

The criteria is applied to cells in range. When cells in range meet criteria, corresponding cells in sum_range are summed. The sum_range argument is optional. If sum_range is omitted, the cells in range are summed instead.

Worksheet example

In the worksheet shown, there are three SUMIF formulas. In the first formula (G5), SUMIF returns total Sales where Name = "jim".  In the second formula (G6), SUMIF returns total Sales where State = "ca" (California).  In the third formula (G7), SUMIF returns the total of Sales > 100:

=SUMIF(B5:B15,"jim",D5:D15) // name = "jim"
=SUMIF(C5:C15,"ca",D5:D15) // state = "ca"
=SUMIF(D5:D15,">100") // sales > 100

Notice the equals sign (=) is not required when constructing "is equal to" criteria. Also notice SUMIF is not case-sensitive; you can use "jim" or "Jim". Finally, notice that the last formula does not include sum_range, so range is summed instead.

Criteria in another cell

A value from another cell can be included in criteria using concatenation. In the example below, SUMIF will return the sum of all sales over the value in G4.  Notice the greater than operator (>), which is text, must be enclosed in quotes. The formula in G5 is:

=SUMIF(D5:D9,">"&G4) // sum if greater than G4

What function should be used when adding the cells specified by the condition or criteria?

Not equal to

To express "not equal to" criteria, use the "<>" operator surrounded by double quotes (""):

What function should be used when adding the cells specified by the condition or criteria?

=SUMIF(B5:B9,"<>red",C5:C9) // not equal to "red"
=SUMIF(B5:B9,"<>blue",C5:C9) // not equal to "blue"
=SUMIF(B5:B9,"<>"&E7,C5:C9) // not equal to E7

Again notice SUMIF is not case-sensitive.

Blank cells

SUMIF can calculate sums based on cells that are blank or not blank. In the example below,  SUMIF is used to sum the amounts in column C depending on whether column D contains "x" or is empty:

What function should be used when adding the cells specified by the condition or criteria?

=SUMIF(D5:D9,"",C5:C9) // blank
=SUMIF(D5:D9,"<>",C5:C9) // not blank

Dates

The best way to use SUMIF with dates is to refer to a valid date in another cell, or use the DATE function. The example below shows both methods:

What function should be used when adding the cells specified by the condition or criteria?

=SUMIF(B5:B9,"<"&DATE(2019,3,1),C5:C9)
=SUMIF(B5:B9,">="&DATE(2019,4,1),C5:C9)
=SUMIF(B5:B9,">"&E9,C5:C9)

Notice we must concatenate an operator to the date in E9. To use more advanced date criteria (i.e. all dates in a given month, or all dates between two dates) you'll want to switch to the SUMIFS function, which can handle multiple criteria.

Wildcards

The SUMIF function supports wildcards, as seen in the example below:

What function should be used when adding the cells specified by the condition or criteria?

=SUMIF(B5:B9,"mi*",C5:C9) // begins with "mi"
=SUMIF(B5:B9,"*ota",C5:C9) // ends with "ota"
=SUMIF(B5:B9,"????",C5:C9) // contains 4 characters

See below for more SUMIF formula examples.

Notes

  • SUMIF only supports one condition. Use the SUMIFS function for multiple criteria.
  • When sum_range is omitted, the cells in range will be summed.
  • Text strings in criteria must be enclosed in double quotes (""), i.e. "apple", ">32", "ja*"
  • Cell references in criteria are not enclosed in quotes, i.e. "<"&A1
  • The wildcard characters ? and * can be used in criteria. A question mark matches any one character and an asterisk matches any sequence of characters (zero or more).
  • To find a literal question mark or asterisk, use a tilde (~) in front of the question mark or asterisk (i.e. ~?, ~*).
  • SUMIFS requires a range, you can't substitute an array.

What does Sumif function do?

The SUMIFS function, one of the math and trig functions, adds all of its arguments that meet multiple criteria. For example, you would use SUMIFS to sum the number of retailers in the country who (1) reside in a single zip code and (2) whose profits exceed a specific dollar value.

What is Sumif and Sumifs in Excel?

The SUMIF formula returns the sum of cells based on one criterion (a result that matches one condition). Whereas, the SUMIFS function returns the sum of cells that meet multiple criteria.

What does Sumif stand for?

As the name suggests SUMIF and SUMIFS formulae are formed by combining SUM and IF functions. In simple English, this implies that these functions can add items or cells that fulfill a particular criterion.

What function returns the sum of the products of corresponding ranges or arrays?

The SUMPRODUCT function returns the sum of the products of corresponding ranges or arrays. The default operation is multiplication, but addition, subtraction, and division are also possible.