Count visible rows with criteria in Excel
It is easy to count only visible rows in a filtered list with the SUBTOTAL function. However, if you want to count visible rows with criteria, the SUBTOTAL function cannot help to achieve. You need to apply a formula based on the SUMPRODUCT, SUBTOTAL and OFFSET functions. This tutorial provides detailed steps to help you get through it.
How to count visible rows with criteria in Excel?
The below product table has been filtered by Shop A, to count only the visible Laptop in the Product column, you need to apply the below formula.
Generic Formulas
=SUMPRODUCT((range=criteria)*(SUBTOTAL(103,OFFSET(range_fiestcell,ROW(range)-MIN(ROW(range)),0))))
Arguments
How to use these formulas?
1. Select a blank cell to output the result.
2. Enter the below formula into it and press the Enter key. Then the result is displayed in the selected cell.
=SUMPRODUCT((D3:D15=C18)*(SUBTOTAL(103,OFFSET(D3,ROW(D3:D15)-MIN(ROW(D3:D15)),0))))
Notes::
=SUMPRODUCT((D3:D15="Laptop")*(SUBTOTAL(103,OFFSET(D3,ROW(D3:D15)-MIN(ROW(D3:D15)),0))))
Related functions
Excel SUMPRODUCT function
The Excel SUMPRODUCT function can be used to multiply two or more columns or arrays together, and then get the sum of products.
Excel SUBTOTAL function
The Excel SUBTOTAL function returns a subtotal in a list or database
Excel ROW function
The Excel ROW function returns the row number of a reference.
Excel MIN function
The Excel MIN function Returns the smallest number in a set of values.
Related formulas
Count Number Of Visible Rows In A Filtered List
This tutorial explains how to count number of visible rows in a filtered list in Excel with the SUBTOTAL function.
Count unique values in a range
This tutorial explains how to count only the unique values among duplicates in a list in Excel with specified formulas.
Count unique values with criteria
This step-by-step guide helps to count only unique values based on a specified criteria in another column
Use COUNTIF on a non-contiguous range
This step-by-step guide demonstrates how to use the countif function on a non-contiguous range in Excel.
The Best Office Productivity Tools
Kutools for Excel - Helps You To Stand Out From Crowd
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...
Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)
- One second to switch between dozens of open documents!
- Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
- Increases your productivity by 50% when viewing and editing multiple documents.
- Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.