Description
Use this function to return the sum of cells that meet a single condition. Supported in Chains.
語法
SUMIF(range,criteria, [sum_range])
Inputs
This function accepts the following arguments:
名稱 | 必要 | 說明 | Valid input |
---|---|---|---|
範圍 |
是 | 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. |
準則 |
是 | 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] |
沒有 | 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. |
範例
範例資料
A | B |
---|---|
51 | 56 |
93 | 39 |
egg | 15 |
19 | 92 |
75 | 22 |
Sample formulas
公式 | 說明 | 結果 |
---|---|---|
=SUMIF(1) |
Adds the number "1". | 1 |
=SUMIF(A1:A7) |
Adds the values in cells A1 through A7 inclusive. The value in cell A3, being text, is treated as "0". | 305 |
=SUMIF(A1:A2, B5) |
Adds the values in cells A1 through A2 inclusive, plus the value of cell B5. | 206 |
=SUMIF(A1:A2, B2:B5) |
Adds the values in cells A1 through A2 inclusive, plus the values in cells B1 through B5 inclusive | 675 |
附註
- The
sum_range
value 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.
提示
TBD
Related functions
ABS
EXP
LN
MOD
N
POWER
PRODUCT
SIGN
SQRT
SUBTOTAL
SUM
SUMIF
SUMIFS
SUMPRODUCT