How to count filtered cells with text in Excel?
In Excel, counting cells with text is simple. But when it comes to counting filtered cells with text, things get tricky. This tutorial will introduce three ways to count the cells with text from a filtered list.
Count filtered text cells using a helper column
Count filtered text cells using SUMPRODUCT, SUBTOTAL, INDIRECT, ROW, and ISTEXT functions
Count filtered text cells using SUMPRODUCT, SUBTOTAL, OFFSET, MIN, ROW & ISTEXT Functions
Count filtered text cells using a helper column
Using the COUNTIF function, in addition with the help of a helper column, we can easily count the filtered text cells. Please do as follows.
1. Please copy the formula below into cell D2, then press the "Enter" key to get the first result.
=SUBTOTAL (103, A2)
Note: The helper column with the SUBTOTAL formula is for testing whether the row is filtered or not. And "103" stands for the "COUNTA" function in the "function_num" argument.
2. Then drag the fill handle down to the cells you want to apply this formula too.
3. Please copy the formula below into cell "F2", then press the "Enter" key to get the final result.
=COUNTIFS(A2:A18,"*", D2:D18, 1)
We can see that there are "4" cells with text in the filtered data.
Count filtered text cells using SUMPRODUCT, SUBTOTAL, INDIRECT, ROW, and ISTEXT functions
Another method of counting the filtered cells with text is using the "combination" of the "SUMPRODUCT", "SUBTOTAL", "INDIRECT", "ROW" & "ISTEXT" Functions. Please do as follows.
Please copy the formula below into cell" E2", then press the "Enter" key to get the result.
=SUMPRODUCT(SUBTOTAL(103, INDIRECT("A"&ROW(A2:A18))), --(ISTEXT(A2:A18)))
Formula Explanation:
- "ROW(A2:A18)" returns the respective row numbers of the range A2:A18.
- "INDIRECT("A"&ROW(A2:A18))" returns the valid cell references from the given range.
- "SUBTOTAL(103, INDIRECT("A"&ROW(A2:A18)))" tests whether the row is filtered or not, and returns 1 for the visible cells, 0 for the hidden and empty cells.
- "ISTEXT(A2:A18)" checks if each cell in range A2:A18 contains text, and return True for the cells with text, False for the other cells. The double unary operator (--) coerces the TRUE and FALSE values into 1's and 0's.
- "SUMPRODUCT(SUBTOTAL(103, INDIRECT("A"&ROW(A2:A18))), --(ISTEXT(A2:A18)))" can be viewed as "SUMPRODUCT({1;1;1;1;1;1;1;1;1}, {0;0;0;1;1;0;0;1;1})". Then the SUMPRODUCT multiplies the two arrays together and returns the sum of values, which is 4.
Count filtered text cells using SUMPRODUCT, SUBTOTAL, OFFSET, MIN, ROW & ISTEXT Functions
The third method of counting the cells with text from a filtered data is "concatenating" the "SUMPRODUCT", "SUBTOTAL", "OFFSET", "MIN", "ROW" & "ISTEXT" Functions. Please do as follows.
Please copy the formula below into cell "E2", then press the "Enter" key to get the result.
=SUMPRODUCT(SUBTOTAL(103, OFFSET(A2:A18, ROW(A2:A18)-2 -- MIN(ROW(A2:A18)-2),,1)), -- (ISTEXT(A2:A18)))
Formula Explanation:
- "OFFSET(A2:A18, ROW(A2:A18)-2 -- MIN(ROW(A2:A18)-2),,1)" returns the individual cell references from range A2:A18.
- "SUBTOTAL(103, OFFSET(A2:A18, ROW(A2:A18)-2 -- MIN(ROW(A2:A18)-2),,1))" checks whether the row is filtered or not, and returns 1 for the visible cells, 0 for the hidden and empty cells.
- "ISTEXT(A2:A18)" checks if each cell in range A2:A18 contains text, and return True for the cells with text, False for the other cells. The double unary operator (--) coerces the TRUE and FALSE values into 1's and 0's.
- "SUMPRODUCT(SUBTOTAL(103, OFFSET(A2:A18, ROW(A2:A18)-2 -- MIN(ROW(A2:A18)-2),,1)), -- (ISTEXT(A2:A18)))" can be viewed as "SUMPRODUCT({1;1;1;1;1;1;1;1;1}, {0;0;0;1;1;0;0;1;1})". Then the SUMPRODUCT multiplies the two arrays together and returns the sum of values, which is 4.
Other Operations (Articles)
Combine The COUNTIF And LEFT Functions To Count Cells Begin With A Certain Character In Excel
To count the number of cells which begin with a certain character in Excel, you can combine the COUNTIF and LEFT functions to get it done. Actually there are different kinds of formulas can achieve it. This tutorial will guide you step by step.
How To Count Cells Containing Numbers Or Not In Excel?
If there are a range of cells, some are containing numbers, and the other containing text, how can you count the cells containing numbers or not quickly in Excel?
How To Count Cells If One Of Multiple Criteria Met In Excel?
What if counting cells if contain one of multiple criteria? Here I will share the ways to count cells if contain X or Y or Z ⦠etc. in Excel.
How To Count Cells With Specific Text And Fill/Font Color In Excel?
Do you know how to count cells with multiple conditions? For example, count number of cells that contain both specific text and font/fill color. This article will show you the solution.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
All Kutools add-ins. One installer
Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.





- All-in-one suite ā Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
- One installer, one license ā set up in minutes (MSI-ready)
- Works better together ā streamlined productivity across Office apps
- 30-day full-featured trial ā no registration, no credit card
- Best value ā save vs buying individual add-in