There are several ways to go about this task, depending on your needs.

The article below explains different approaches.

COUNTA function

While theCOUNT functiononly counts numbers, theCOUNTA functioncounts both numbers and text.

Using SUMPRODUCT to count cells that are not blank

This means you could use COUNTA as a simple way to count cells that are not blank.

COUNTA is fully automatic, so there is nothing to configure.

The secondrange/criteriapair selects cells that are not empty.

Using SUMPRODUCT to count cells that are not blank

The result from COUNTIFS is 4, since there are 4 cells in Group A that are not empty.

it’s possible for you to swap the order of therange/criteriapairs with the same result.

See also:50 examples of formula criteria.

Using SUMPRODUCT to count cells that are not blank

But this formula will ignore empty strings ("") returned by formulas.

you’re free to easily adjust the logic used in SUMPRODUCT with other functions as needed.

you could read more about this topic here:Why SUMPRODUCT?

Using SUMPRODUCT to count cells that are not blank

COUNTA does not count empty cells.

COUNTBLANK Function

The Excel COUNTBLANK function returns a count of empty cells in arange.

Cells that contain text, numbers, errors, spaces, etc.

Using SUMPRODUCT to count cells that are not blank

Formulas that return empty strings ("")arecounted as blank.

Excel formula: Count cells that contain numbers

Excel formula: Count cells that contain text

Excel formula: Count cells that are blank

Excel COUNTA function

Excel COUNTBLANK function

Excel COUNTIFS function

Excel SUMPRODUCT function

Using SUMPRODUCT to count cells that are not blank