Problem:

Counting the number of cells containing text values in the range A1:B5.

Solution:

Use the SUM, IF, and ISTEXT functions as shown in the following Array formula:
{=SUM(IF(ISTEXT(A1:B5),1,0))}