The COUNTIF() function allows you to count the number of items in a text field or text value that meet a given criterion. It is designed to analyze lists of values (e.g.: list of tags, emails, identifiers, etc.) separated by a specific character.
-
Function name:
COUNTIF()
Syntax
COUNTIF(values, criteria, separator)
ℹ Calling function parameters in TimeTonic:
- $field_name = field (link, linked table column, number, selection, formula, text...).
- "free text" = free text to be added between quotation marks.
- do not use quotation marks for numbers.
Parameters
| Parameter | Description |
|---|---|
values |
TimeTonic field (text or relation) or text value containing several items to analyze (e.g. "value1,value2,value3"). |
criteria |
Condition applied to each item.
|
separator |
(Optional) Character used to split the items (e.g. ",", " ", ";"). By default, the comma , is used. |
Examples
COUNTIF("a@timetonic.com, b@timetonic.com, c@gmail.com",
"CONTAINS timetonic.com")➡️ Result: 2
COUNTIF("Urgent", "In progress", "Pending", "Urgent")
➡️ Result: 1
COUNTIF("101 205 301 50", "100", " ")
➡️ Result: 3
COUNTIF("a,, c, d, e", "EMPTY")
➡️ Result: 1
COUNTIF("a,, c, d, e", "NOT EMPTY")
➡️ Result: 4
NOTES :
- COUNTIF() analyzes each item individually after splitting according to the separator.
- Without an operator (
CONTAINS,>, etc.), the criterion matches an exact equality. - The
CONTAINSoperator is only useful for partial searches (e.g.: start or fragment of a word). - The function is not case-sensitive.
Return type
The function returns a number.
The output type format of the result can be configured in the output field options of the formula editor. For more details, see Output format options in the Formula column article.