The DISTINCTCOUNT function counts the number of distinct values in a column.
DISTINCTCOUNT(
column
)
- column: Name of the column whose different values you want to count.
The DISTINCTCOUNT function returns an integer.
The only allowed argument is the name of a column.
The values to be counted can be numeric or of any other type. In the case of existing Blanks, they are included in the count. If you do not want to include Blanks, use the DISTINCTCOUNTNOBLANK function.
If no values are found to count, the function returns Blank.
It should be noted that, for the calculation, the function is contextualized. In other words, it does not calculate, in the strict sense of the term, the number of different values in a column, but the number of different values in the column once the corresponding context is applied to it.
This example counts the number of different cells in a column containing numbers:
Note how among the 7 different values is the Blank (0, 1, 2, 3, 4, 6 and Blank).
In this second example we count the number of cells that, containing texts, are different:
In this example we define a custom column in which we introduce the Boolean True if the product is A, and False otherwise:
Es A = IF(Productos[Producto] = "Producto A", TRUE(), FALSE())
...and, in a new column, we count the number of different cells in the latter (in this case, Booleans):