COUNTBLANKS

COUNTBLANKS(array)[source]

Counts the number of blank elements in an array.

COUNTBLANKS evaluates the input array and returns the total number of blank elements. A blank element is defined as either:

  1. A null value for any data type

  2. An empty string (“”) for string arrays

Parameters:

array (Operand) –

The array to evaluate for blank elements. Must be a valid array type or object array.

Supported types:

  • BOOLEAN_ARRAY

  • INTEGER_ARRAY

  • DECIMAL_ARRAY

  • STRING_ARRAY

  • DATE_ARRAY

  • TIME_ARRAY

  • DATETIME_ARRAY

  • OBJECT_ARRAY

Return type:

Formula

Returns:

A formula object evaluating to an INTEGER representing the number of blank elements in the array.

Supported types:

  • INTEGER

Raises:

ValueError – If array is not an array type

Examples

Counting blanks in a numeric array:

COUNTBLANKS([1, null, 3, null])
# Returns 2
# Explanation: Two null values are counted as blanks

Counting blanks in a string array:

COUNTBLANKS(["A", "", "B", null])
# Returns 2
# Explanation: Empty string and null are counted as blanks