How to Count Rows with Text in Excel (Easiest 7 Ways)

If you are looking for some of the easiest ways to count rows with text in Excel, then you will find this article worthy of it. Sometimes different texts and numbers and other types of variables get mixed up in a column. So, if you want to count rows based on texts, then let’s go through this article.


How to Count Rows with Text in Excel: 7 Ways

Here, I have used the following table, where in the Size column, I have both text and number variables. Furthermore, the number of rows will be counted here based on the texts in this column. So, using the following example, I will try to explain the methods.

Dataset to Count Rows with Text in Excel


Method-1: Use of COUNTIF Function to Count Rows with Any Text

To count the number of texts in the Size column you have to use the COUNTIF function here. Here, I have added a column named Count for counting the number of texts.

Using COUNTIF Function to Count Rows with Any Text

Steps:
➤ Firstly, select the output cell in the Count column.
➤ Secondly, type the following function here:

=COUNTIF(C5:C13,"*")

Here, C5:C13 is the range, and * is the wildcard that matches any number of text characters.

➤ Subsequently, press ENTER.
➤ Now, it will show up the value of texts in the Size column.


Method-2: Counting Rows with Specific Text in Excel

Suppose I will now search in the Product column how many Shirts are there. To do this you have to use the COUNTIF function and enter the specific text name here.

Steps:
➤ First, select the output cell in the Count column.
➤ Secondly, type the following function here:

=COUNTIF(B5:B13,"*Shirt*")

Here, B5:B13 is the range, and between the wildcards, Shirt is used for searching this text.

How to Count Rows with Text in Excel with Specific Text

➤ Then, press ENTER.
➤ Now, it will show up the number of shirts in the Product column.


Method-3: Combination of Functions to Count Rows Based on Multiple Criteria

Suppose you now want to find in the Product column how many Shirts and Shoes are there. To do this you have to use the SUMPRODUCT function here.

Steps:
➤ First, select the output cell in the Count column.
➤ Secondly, type the following function here:

=SUMPRODUCT(--(ISNUMBER(FIND("Shirt",B5:B13))+ISNUMBER(FIND("Shoe",B5:B13))>0))

Count Rows with Text in Excel Based on Multiple Criteria

Formula Breakdown

Here, B5:B13 is the range. Then, using the FIND function, you will find the desired texts Shirt and Shoe.
After that, the ISNUMBER function will return an array containing 1 and 0. 1 will be for the case where the criteria are met and 0 is for not meeting the criteria.
Finally, the SUMPRODUCT function will add up the values.

➤ After that, press ENTER.
➤ So, it will show up the number of shirts and shoes in the Product column.


Method-4: Counting Rows with Non-Text Values

If you want to find the non-text values like numbers in the Size column, then you have to use the COUNTIF function here.

Steps:
➤ First, select the output cell in the Count column.
➤ Secondly, type the following function here:

=COUNTIF(C5:C13,"<>*")

Here, C5:C13 is the range, and before the wildcard, <> is used which means Not Equal to.

How to Count Rows with Non-Text Values in Excel

➤ Consequently, press ENTER.
➤ Then, it will show up the number of numerical values in the Size column.


Method-5: Applying SUMPRODUCT & ISTEXT Functions

You can use the SUMPRODUCT function to get the number of texts in the Size column.

Steps:
➤ First, select the output cell in the Count column.
➤ Secondly, type the following function here:

=SUMPRODUCT(--ISTEXT(C5:C13))

Here, C5:C13 is the range, the ISTEXT function will check out if there are texts and then will return TRUE and if there are no texts then it will return FALSE. Then will convert TRUE into 1 and FALSE into 0. Then the SUMPRODUCT function will sum up the values.

Using SUMPRODUCT Function to Count Rows with Text in Excel

➤ Then, press ENTER.
➤ As a result, it will show up the number of texts in the Size column.


Method-6: Use of SUM, IF & ISTEXT Functions to Count Rows with Text

Here, you can count the number of texts by using the array formula as well.

Steps:
➤ First, select the output cell in the Count column.
➤ Secondly, type the following function here.

=SUM(IF(ISTEXT(C5:C13),1))

Here, C5:C13 is the range, the IF function will return 1 if there is text and then the SUM function will sum up these values.

Use Combined Functions to Count Rows with Text in Excel

➤ Subsequently, press ENTER.
➤ Now, it will show up the number of texts in the Size column.

Note:
If you are using an Excel version other than Excel 365, then you may need to press CTRL+SHIFT+ENTER.  

Method-7: Counting Rows with Filtered Texts

Suppose you want to count texts in a filtered data table but in this case, you will get the total text values not only the shown values in the filtered column. But you can count the visible values only after filtering by following this method.
Before filtering data, you just have to do some extra tasks like the one below.

How to Count Rows with Filtered Texts in Excel

Steps:
➤ Firstly, select cell E5 of the Filtered Value column.
➤ Secondly, type the following formula:

=SUBTOTAL(103,C5)

Actually, to identify all hidden cells, filtered out and hidden manually, function_num is used as 103. And C5 is the reference.

➤ Then, press ENTER.
➤ After that, drag down the Fill handle tool.

Now, you will get 1 for all of the rows.

➤ Now, you can filter the values according to your needs.
➤ Then, select the output cell in the Count column.
➤ Then, type the following formula:

=COUNTIFS(C5:C13, "*", E5:E13, 1)

Here, to count the number of visible texts, you can use the COUNTIFS function.

➤ After that, press ENTER.
➤ As a result, it will return the number of texts visible in the Size column.

Here, you can do the aforementioned task by typing only the following formula.

=SUMPRODUCT(SUBTOTAL(103, INDIRECT("C"&ROW(C5:C13))), --(ISTEXT(C5:C13)))

How to Count Rows with Text in Excel

Otherwise, use the following formula.

=SUMPRODUCT(SUBTOTAL(103, OFFSET(C5:C13, ROW(C5:C13) - MIN(ROW(C5:C13)),,1)), -- (ISTEXT(C5:C13)))

Here, by the following steps, you can change the filtered text.

  • First, click on the drop-down arrow >> then from the list >> select required texts >> press OK.


Practice Section

For doing practice by yourself we have provided a pactice section like below for each method in each sheet on the right side. Please do it by yourself.

Practice Section to Count Rows with Text in Excel


Download Practice Workbook


Conclusion

Here, in this article, I tried to cover the easiest ways to count rows with text in Excel effectively. Hope you will find it useful. If you have any suggestions or questions, feel free to share them with us.


<< Go Back to Count Rows | Formula List | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Tanjima Hossain
Tanjima Hossain

TANJIMA HOSSAIN is a marine engineer who enjoys working with Excel and VBA programming. For her, programming is a handy, time-saving tool for managing data, files, and online tasks. She's skilled in Rhino3D, Maxsurf C++, MS Office, AutoCAD, and Excel & VBA, going beyond the basics. She holds a B.Sc. in Naval Architecture & Marine Engineering from BUET and is now a content developer. In this role, she creates tech-focused content centred around Excel and VBA. Apart from... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo