SUMIF
Returns a conditional sum across a range.
Examples​
[SUMIF for BigQuery]
Sample Usage​
SUMIF(A1:A10,">20")
SUMIF(A1:A10,"Paid",B1:B10)
Syntax​
SUMIF(range, criterion, [sum_range])
range
- The range which is tested againstcriterion
.criterion
- The pattern or test to apply torange
.- If
range
contains text to check against,criterion
must be a string.criterion
can contain wildcards including?
to match any single character or*
to match zero or more contiguous characters. To match an actual question mark or asterisk, prefix the character with the tilde (~
) character (i.e.~?
and~*
). A string criterion must be enclosed in quotation marks. Each cell inrange
is then checked againstcriterion
for equality (or match, if wildcards are used). - If
range
contains numbers to check against,criterion
may be either a string or a number. If a number is provided, each cell inrange
is checked for equality withcriterion
. Otherwise,criterion
may be a string containing a number (which also checks for equality), or a number prefixed with any of the following operators:=
(checks for equality),>
(checks that the range cell value is greater than the criterion value), or<
(checks that the range cell value is less than the criterion value)
- If
sum_range
- The range to be summed, if different fromrange
.
Notes​
SUMIF
can only perform conditional sums with a single criterion. To use multiple criteria, use the database functionDSUM
.
See Also​
SUMSQ
: Returns the sum of the squares of a series of numbers and/or cells.
SUM
: Returns the sum of a series of numbers and/or cells.
SERIESSUM
: Given parameters x
, n
, m
, and a
, returns the power series sum a1x^n^ + a2x^(n+m)^ + ... + aix^(n+(i-1)m)^, where i is the number of entries in range `a`.
QUOTIENT
: Returns one number divided by another, without the remainder.
PRODUCT
: Returns the result of multiplying a series of numbers together.
MULTIPLY
: Returns the product of two numbers. Equivalent to the `*` operator.
MINUS
: Returns the difference of two numbers. Equivalent to the `-` operator.
DSUM
: Returns the sum of values selected from a database table-like array or range using a SQL-like query.
DIVIDE
: Returns one number divided by another. Equivalent to the `/` operator.
COUNTIF
: Returns a conditional count across a range.
ADD
: Returns the sum of two numbers. Equivalent to the `+` operator.