The Excel SUMIF Function

Related Functions:
SUMIFS
AVERAGEIF
AVERAGEIFS

Basic Description

The Excel Sumif function finds the values in a supplied array, that satisfy a given criteria, and returns the sum of the corresponding values in a second supplied array.

The syntax of the function is:

SUMIF( range, criteria, [sum_range] )

Where the function arguments are:

range-An array of values (or range of cells containing values) to be tested against the supplied criteria.
criteria-The condition to be tested against each of the values in the supplied range.
[sum_range]-

An optional array of numeric values (or cells containing numbers) which are to be added together, if the corresponding range entry satisfies the supplied criteria.

If the [sum_range] argument is omitted, the values from the range argument are summed instead.

Wildcards

The following wildcards can be used in text-related criteria:

?    -    matches any single character
*    -    matches any sequence of characters

(if you do actually want to find the ? or * character, type the ~ symbol before this character in your search.)

E.g. the condition "A*e" will match all cells containing a text string beginning with "A" and ending in "e".

The supplied criteria argument can be either:

oror

Note that:


Excel Sumif Function Examples

Example 1

The spreadsheet below shows three examples of the Excel Sumif function used with text based critia.

For each call to the Excel Sumif function the range argument (to be tested against the criteria) is either the cell range A2 - A9 or the cell range B2 - B9, and the [sum_range] argument (containing the values to be summed) is the cell range C2 - C9.

 Formulas:

 ABC
1Month Team Sales 
2JanNorth 1$36,693
3JanNorth 2$22,100
4JanSouth 1$53,321
5JanSouth 2$34,440
6FebNorth 1$29,889
7FebNorth 2$50,090
8FebSouth 1$32,080
9FebSouth 2$45,500
10   
11=SUMIF( A2:A9, "Feb", C2:C9 )
12=SUMIF( B2:B9, "North 1", C2:C9 )
13=SUMIF( B2:B9, "North*", C2:C9 )

 Results:

 ABC
1Month Team Sales 
2JanNorth 1$36,693
3JanNorth 2$22,100
4JanSouth 1$53,321
5JanSouth 2$34,440
6FebNorth 1$29,889
7FebNorth 2$50,090
8FebSouth 1$32,080
9FebSouth 2$45,500
10   
11$157,559  - sum of cells C6-C9
12$66,582  - sum of cells C2 & C6
13$138,772  - sum of cells C2, C3, C6 & C7

Note that, in the example above:


Example 2

The following example shows the Excel Sumif function using critia based on numeric values.

 Formulas:

 ABC
11200 
2245 
31550 
42450 
5120 
6   
7=SUMIF( A1:A5, 1, B1:B5 )
8=SUMIF(B1:B5, ">100" )

 Results:

 ABC
11200 
2245 
31550 
42450 
5120 
6   
7770  - sum of cells B1, B3 & B5
81200  - sum of cells B1, B3 & B4

Note that, in the above spreadsheet:


Further examples of the Excel Sumif function are provided on the Microsoft Office website.


Sumif Function Errors

If you get an error from the Excel Sumif function, this is likely to be the #VALUE! error:

Common Error
#VALUE!-Occurs if the supplied criteria is a text string that is more than 255 characters long.