Sumif() Function

SUMIF is a function to sum cells that meet a single criteria. SUMIF can be used to sum cells based on dates, numbers, and text that match specific criteria.

SUMIF supports logical operators (>,<,<>,=) and wildcards (*,?) for partial matching.

Syntax

The syntax for the SUMIF function in Microsoft Excel is:

SUMIF( range, criteria, [sum_range] )

Parameters or Arguments

range

The range of cells that you want to apply the criteria against. Cells in each range must be numbers or names, arrays, or references that contain numbers. Blank and text values are ignored.

criteria

The criteria used to determine which cells to add. The criteria in the form of a number, expression, a cell reference, text, or a function that defines which cells will be added.

sum_range

Optional. It is the range of cells to sum together. If this parameter is omitted, it uses range as the sum_range.

Excel Sumif Function Examples

Example 1

The following spreadsheet 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:

Results:

Note that, in the example above:

–          The function in cell A13 uses the wildcard * and so finds cells in the range B2-B9 that begin with the text string “North”. This is satisfied by the values “North 1” and “North 2”.

–          In all three examples, the text based criteria (including the wildcard) are encased in quotes.

Example 2

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

Formulas:

Results:

Note that, in the above spreadsheet:

–          The criteria in cell A8 is an expression, and so, is enclosed in quotes.

–          The [sum_range] argument is omitted from the function in cell A8 and so the values in the range array (i.e. cells B2-B6) are summed.

Notes

–          When sum_range is omitted, the cells in range will be summed.

–          Text criteria, or criteria that includes math symbols, must be enclosed in double quotation marks (“).

–          Numeric criteria can be supplied without quotation marks.

–          The wildcard characters can be used in criteria.

–          The SUMIF function returns incorrect results when you use it to match strings longer than 255 characters or to the string #VALUE!.

–          The Excel Sumif function is not case-sensitive. So, for example, the text strings “TEXT” and “text” will be evaluated as equal.

–          The sum_range argument does not have to be the same size and shape as the range argument. The actual cells that are added are determined by using the upper leftmost cell in the sum_range argument as the beginning cell, and then including cells that correspond in size and shape to the range argument. For example:

–          However, when the range and sum_range arguments in the SUMIF function do not contain the same number of cells, worksheet recalculation may take longer than expected.