How to quickly count visible or filtered cells only in Excel?
Generally, in Excel, the normal formula =COUNT(B3:B16) will count the number of all invisible cells and hidden cells. But in this tutorial, I will introduce some quick ways to help you count the visible or filtered cells only in Excel.
Count visible cells only with User Defined Function
Use a User Defined Function to count the visible cells only.
1. Press Alt + F11 keys simultaneously, a Microsoft Visual Basic for Applications window pops out.
2. Click Insert > Module, and paste below VBA code to the popped out Module window.
VBA: Count visible cells only.
Dim xCount As Long
Dim xCell As Range
For Each xCell In Rg
If (Not xCell.EntireRow.Hidden) And (Not xCell.EntireColumn.Hidden) Then
xCount = xCount + 1
COUNTVISIBLE = xCount
3. Then save the code and close the Module window, and then select a cell that output result, and type this formula =COUNTVISIBLE(B3:B16), and press the Enter key to get the result. See screenshots:
Count visible cells only with Kutools for Excel
To count visible cells only, you also can use Kutools for Excel’s COUNTVISIBLE function to quickly solve it.
Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
More than 300 powerful features. Supports Office/Excel
2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features
30-day free trial. 60-day money back guarantee.