COUNTIF Function
Counts the number of cells in a range that meet a single condition. One of the most commonly used functions for data analysis.
ExcelGoogle Sheets
语法
COUNTIF(range, criteria)参数
| 参数名 | 说明 |
|---|---|
| range | The range of cells to count. |
| criteria | The condition that determines which cells to count. |
示例
Count orders from a specific region
=COUNTIF(A2:A100, "East")结果: 23
Count values above a threshold
=COUNTIF(B2:B100, ">1000")结果: 15
Count non-blank cells
=COUNTIF(A2:A100, "<>")结果: 87
Count cells containing specific text
=COUNTIF(A2:A100, "*apple*")结果: Counts cells containing 'apple' anywhere in the text
技巧与最佳实践
- •Use "<>" as criteria to count non-empty cells (or COUNTA).
- •Wildcards: * matches any characters, ? matches a single character.
- •For multiple conditions, use COUNTIFS.
- •COUNTIF is case-insensitive for text criteria.
相关公式
需要其他公式?
用自然语言描述您的需求,AI 将为您生成公式。
试试公式生成器