Microsoft Office Tutorials and References

In Depth Information

FIguRE 3-18
Different measures using statistical functions aggregate LineTotal.

The only interesting function in the group of A-suffixed functions is the COUNTA one. It

returns the number of cells that are not empty and works on any type of column. If you are

interested in counting all the cells in a column containing an empty value, you can use the

COUNTBLANK functions. Finally, if you want to count all the cells of a column regardless of

their content, you want to count the number of rows of the table, which can be obtained by

calling the COUNTROWS function. (It gets a table as a parameter, not a column.) In other

words, the sum of COUNTA and COUNTBLANK for the same column of a table is always

equal to the number of rows of the same table, as you can also see in Figure 3-19:

COUNTROWS( Sales ) = COUNTA( Sales[SalesPersonID] ) + COUNTBLANK( Sales[SalesPersonID] )

FIguRE 3-19
The COUNTROWS function returns the sum of COUNTA and COUNTBLANK of the same column.

So you have four functions to count the number of elements in a column or table:

■
COUNT operates only on numeric columns

■
COUNTA operates on any type of columns

■
COUNTBLANK returns the number of empty cells in a column

■
COUNTROWS returns the number of rows in a table