Description
Use this function to return the sum of cells that meet a single condition. Supported in Chains.
Syntax
SUMIF(range,criteria, [sum_range])
Inputs
This function accepts the following arguments:
| Name | Required | Description | Valid input |
|---|---|---|---|
range |
Yes | The range to be considered. | A cell, a cell range, or a formula which results in a cell range. A hard-coded value is also acceptable. |
criteria |
Yes | Additional numbers to be added. | A cell reference (including a range), a number, or a formula which results in either of these. A hard-coded value is also acceptable. |
[sum_range] |
No | The actual cells to be added, if you want to add cells other than those specified in range. If the sum_range argument is omitted, the cells that are added are those that are specified in range. |
A cell, cell range, or a formula which results in a cell range. A hard-coded value is also acceptable. |
Examples
Sample data
| A | B | |
|---|---|---|
| 1 | 51 | 56 |
| 2 | 93 | 39 |
| 3 | egg | 15 |
| 4 | 19 | 92 |
| 5 | 75 | 22 |
Sample formulas
| Use case | Formula | Explanation and Result |
|---|---|---|
| Sum values in a range that meet a specific condition. | =SUMIF(A1:A5, ">50") |
This formula works in the following manner:
For this data set, the formula returns 219. |
| Sum values in one range based on a condition in another range. | =SUMIF(A1:A5, ">=75", B1:B5) |
This formula works in the following manner:
For this data set, the formula returns 61. |
| Sum values in one range, excluding those that meet a specific text criterion in another range. | =SUMIF(A1:A5, "<>egg", B1:B5) |
This formula works in the following manner:
For this data set, the formula returns 209. |
Notes
- The
sum_rangevalue should have the same dimensions as the range provided inrange. If it isn't, performance may suffer, and the formula will sum a range of cells that starts with the first cell insum_range, but has the same dimensions asrange. - SUMIF supports logical operators (>,<,<>,=) and wildcards (*,?) for partial matching.
- Criteria can be applied to dates, numbers, and text.
- SUMIF can calculate sums based on cells that are blank ("") or not blank ("<>").
- If text is included by a cell or range reference, then it is treated as a zero.
- If text is included without quotation marks, the function returns a #NAME! error. If text is included with quotation marks, the function returns a #VALUE! error.
- If arguments contain errors, SUMIF will return an error.
- SUMIF can handle up to 255 total arguments.
- SUMIF supports wildcards.
Tips
TBD