=COUNT(rng)
If you need to count the number of cells are not blank,use the COUNT function. In the generic form of the formula (above) rng represents a range of cells.
In the example, the active cell contains this formula:
=COUNT(B4:B8)Here’s how the formula works:
COUNT counts the number of cells in the range that contain numbers and returns the result as a number.
To count the number of cells in a range that do not contain numbers, use this SUMPRODUCT formula:
=SUMPRODUCT(--NOT(ISNUMBER(B4:B8)))