Skip to main content

Kutools for Office — One Suite. Five Tools. Get More Done.

How to count filtered cells with text in Excel?

Author Zhoumandy Last modified

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.

A screenshot of counting filtered cells with text in Excel

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)

A screenshot of the formula for the SUBTOTAL function in Excel for counting filtered cells with text, placed in cell D2

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.
A screenshot showing the SUBTOTAL function returning results for counting filtered cells with text in Excel

2. Then drag the fill handle down to the cells you want to apply this formula too.
A screenshot showing the filled SUBTOTAL formula being dragged down in Excel

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)

A screenshot of the COUNTIFS formula used in Excel to count filtered cells with text in the dataset

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)))

A screenshot of the SUMPRODUCT and SUBTOTAL combination formula used to count filtered cells with text in Excel

Formula Explanation:
  1. "ROW(A2:A18)" returns the respective row numbers of the range A2:A18.
  2. "INDIRECT("A"&ROW(A2:A18))" returns the valid cell references from the given range.
  3. "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.
  4. "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.
  5. "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)))

A screenshot of the SUMPRODUCT formula with OFFSET, MIN, and ISTEXT functions to count filtered cells with text in Excel

Formula Explanation:
  1. "OFFSET(A2:A18, ROW(A2:A18)-2 -- MIN(ROW(A2:A18)-2),,1)" returns the individual cell references from range A2:A18.
  2. "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.
  3. "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.
  4. "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

šŸ¤– Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

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.

Excel Word Outlook Tabs PowerPoint
  • 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