Share via


WorksheetFunction.SumIfs Method (Excel)

Adds the cells in a range that meet multiple criteria.

Syntax

expression .SumIfs(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name

Required/Optional

Data Type

Description

Arg1

Required

Range

Sum_range - the range to sum.

Arg2

Required

Range

Criteria_range1, criteria_range2, … - one or more ranges in which to evaluate the associated criteria.

Arg3 - Arg30

Required

Variant

Criteria1, criteria2, … - one or more criteria in the form of a number, expression, cell reference, or text that define which cells will be added. For example, criteria can be expressed as 32, "32", ">32", "apples", or B4.

Return Value

Double

Remarks

  • Each cell in sum_range is summed only if all of the corresponding criteria specified are true for that cell.

  • Cells in sum_range that contain TRUE evaluate as 1; cells in sum_range that contain FALSE evaluate as 0 (zero).

  • You can use the wildcard characters, question mark (?) and asterisk (*), in criteria. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

  • Each criteria_range does not have to be the same size and shape as sum_range. The actual cells that are added are determined by using the top, left cell in that criteria_range as the beginning cell, and then including cells that correspond in size and shape to sum_range. For example:

    If sum_range is

    And a criteria_range is

    Then the actual cells evaluated are

    A1:A5

    B1:B5

    B1:B5

    A1:A5

    B1:B3

    B1:B5

    A1:B4

    C1:D4

    C1:D4

    A1:B4

    C1:C2

    C1:D4

See Also

Concepts

WorksheetFunction Object

WorksheetFunction Object Members