COUNTALL
Use the COUNTALL function to get the total number of items in any type of array.
Use
COUNTALL( array )
Count all items in the array, including blank items.
| Parameter | Required | Description |
|---|---|---|
| array | Yes | an array of any type |
| Returns | Number |
Examples
Validating a Required List Size
In a scenario where an approval requires a specific number of data entries—such as a list of three professional references for a job application—you can use COUNTALL to enforce the size of the array. This is applied as an Output Validation Formula on a multi-value capture element.
- Formula:
COUNTALL(this) = 3 - Logic: This formula checks the total count of items in the current field (
this). Because COUNTALL includes blank items, this specific formula ensures that the user has created exactly three entries on the form, preventing them from submitting a list that is too short or too long.
Identifying "Holes" in a Data Set
A common and powerful use for COUNTALL is to pair it with the COUNTA function to ensure that a user has not left any "gaps" or blank rows in a list they have provided.
- Formula:
COUNTA(this) = COUNTALL(this) - Logic:
COUNTA(this)counts only the items that have actual data.COUNTALL(this)counts every item, including empty ones.- Comparison: If a user adds five rows to a table but only fills in four of them,
COUNTAwill return 4, while COUNTALL will return 5. Since the numbers do not match, the formula returns FALSE, and the field is marked as invalid. This ensures the user must fill in every row they created before the form can be submitted.