COUNTA
Use the COUNTA function to get the number of items in any type of array that are not blank.
Use
COUNTA( array )
Counts the non-blank items in array.
| Parameter | Required | Description |
|---|---|---|
| array | Yes | an array of any type |
| Returns | Number |
Examples
Multi-Value Validation (Minimum Requirement)
This formula is used as an Output Validation Formula for an array field (such as a list of "Action Items" or "Project Notes") to ensure that the user has provided at least one meaningful entry.
- Formula:
COUNTA(this) >= 1 - Logic:
this: Refers to the array of data currently being entered in the form field.COUNTA(this): Returns the total number of items in that array that contain data.- Result: If a user adds three rows to an array but only fills in two of them, leaving one blank, the formula returns 2. Since 2 is greater than or equal to 1, the validation passes.
Restricting the Range of Non-Empty Entries
In more complex scenarios, you may want to ensure a user provides a specific number of responses—for instance, between one and five non-empty items,.
- Formula:
AND(COUNTA(this) >= 1, COUNTA(this) <= 5) - Logic:
- This uses the AND function to verify two conditions simultaneously.
- The first part,
COUNTA(this) >= 1, ensures the list isn't effectively empty. - The second part,
COUNTA(this) <= 5, ensures the user hasn't provided more than five actual entries. - Result: This formula returns TRUE only if the number of filled-in items in the array falls strictly between 1 and 5,.