COUNTIF
Use COUNTIF to count the number of items in an array that meet a given criteria.
Use
COUNTIF( array, criteria )
Counts the number of items in the array that meet the given criteria.
Parameter | Required | Description |
---|---|---|
array | Yes | an array of any type |
criteria | Yes | a number, expression, or text value that determines which items will be counted |
Returns | Number |
The format of the criteria depends on the type of the array parameter, as follows:
Array type | Criteria |
---|---|
Text | The criteria is a Text value, which can be a literal, a field, or a formula that returns a Text value. |
Number | The criteria can be either a number or an expression, as follows: Critera as a number The criteria is a Number value, which can be a literal, a field, or a formula that returns a Number value..Critera as an expression The expression needs to include both an operator and an operand. Supported operators are; = (Equals) , != (Not equals) , > (Greater than) , < (Less than) , >= (Greater than or equals) and < (Less than or equals) .An operand is is a Number value, which can be a literal, a field, or a formula that returns a Number value.The text join operator & can also be used to combine elements to make up a criteria, such as "<= " & @inp.Amount |
Logical | The criteria is a Logical value, which can be a literal, a field, or a formula that returns a Logical value. |
Choice | The criteria is a Text value, which can be a literal, a field, or a formula that returns a Text value. |
Date | The criteria can be either a date or an expression, as follows: Critera as a date The criteria is a Date value, which can be a literal, a field, or a formula that returns a Date value.Critera as an expression The expression needs to include both an operator and an operand. Supported operators are; = (Equals) , != (Not equals) , > (Greater than) , < (Less than) , >= (Greater than or equals) and < (Less than or equals) .An operand is is a Date value, which can be a literal, a field, or a formula that returns a Date value.The text join operator & can also be used to combine elements to make up a criteria, such as "<= " & @inp.Anniversary |
Time | The criteria can be either a time or an expression, as follows: Critera as a time The criteria is a Time value, which can be a literal, a field, or a formula that returns a Time value.Critera as an expression The expression needs to include both an operator and an operand. Supported operators are; = (Equals) , != (Not equals) , > (Greater than) , < (Less than) , >= (Greater than or equals) and < (Less than or equals) .An operand is is a Time value, which can be a literal, a field, or a formula that returns a Time value.The text join operator & can also be used to combine elements to make up a criteria, such as "<= " & @inp.ClosingTime |
Date/Time | The criteria can be either a date/time or an expression, as follows: Critera as a date/time The criteria is a Date/Time value, which can be a literal, a field, or a formula that returns a Date/Time value.Critera as an expression The expression needs to include both an operator and an operand. Supported operators are; = (Equals) , != (Not equals) , > (Greater than) , < (Less than) , >= (Greater than or equals) and < (Less than or equals) .An operand is is a Date/Time value, which can be a literal, a field, or a formula that returns a Date/Time value.The text join operator & can also be used to combine elements to make up a criteria, such as "<= " & @inp.Appointment |
Use with literals
COUNTIF({"London", "New York", "Ottawa", "Sydney"}, "Ottawa")
returns 1
COUNTIF({1, 2, 3, 2, 1}, 2)
returns 2
COUNTIF({TRUE, FALSE, BLANK}, TRUE)
returns 1
COUNTIF({1, 2, 3, 2, 1}, "> 2")
returns 1
COUNTIF({1, 2, 3, 2, 1}, "!=" & TEXT(2))
returns 3
Use with fields
COUNTIF(@SubmitClaim.out.Amounts, "> " & TEXT(#MaxClaimValue))
if field @SubmitClaim.out.Amounts contains 4 items with values 10, 20, 40, 60 and constant #MaxClaimValue is 50, returns 1