Counts the number of cells within a range that meet a criterion.
Syntax
COUNTIF(range, criterion)
- range—The group of cells to count.
- criterion—The value that determines which cells in the range will be counted; for example: 15, "Hello World!", or >25.
Sample usage
COUNTIF(Quantity:Quantity, >25)
Usage notes
- For criterion, acceptable operators include:
- = (equal to)
- <> (not equal to)
- > (greater than)
- < (less than)
- >= (greater than or equal to)
- <= (less than or equal to)
Blank cells aren't counted when using <> (not equal to).
For example, the formula =COUNTIF(Item:Item, <> "Shirt") won't count any blank cells that exist in the Item column.
Examples
This example references the following sheet information:
Clothing Item | Transaction Total | Units Sold | In Stock? | |
---|---|---|---|---|
1 | T-Shirt | 1,170.00 | 78 | true |
2 | Pants | 1,491.00 | 42 | false |
3 | Jacket | 812.00 | 217 | true |
Given the table above, here are some examples of using COUNTIF in a sheet:
Formula | Description | Result |
---|---|---|
=COUNTIF([Units Sold]:[Units Sold], >50) | Count the number of rows where the value in the “Units Sold” column is greater than 50. Rows 1 & 3 meet the criteria. | 2 |
=COUNTIF([In Stock?]:[In Stock?], 1) | Count the number of rows where the “In Stock?” checkbox is checked. Rows 1 & 3 meet the criteria. | 2 |
=COUNTIF([Clothing Item]:[Clothing Item], "Jacket") | Count the number of rows where value in the “Clothing Item” column is “Jacket.” Row 3 meets the criteria. | 1 |
Still need help?
Use the Formula Handbook template to find more support resources, and view 100+ formulas, including a glossary of every function that you can practice working with in real time, and examples of commonly used and advanced formulas.
Find examples of how other Smartsheet customers use this function or ask about your specific use case in the Smartsheet online Community.