If you need to count the number of cells are not blank,use the COUNTA function. In the generic form of the formula (above) rng represents a range of cells.
In the example, the active cell contains this formula:
How the formula works
COUNTA is fully automatic. When given a range of cells, it counts cells that contain numbers, text, logical values, and errors. COUNTA does not count empty cells.
To count cells that are blank, you can use the COUNTBLANK function like so:=COUNTBLANK(B4:B8)