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

Range: The range you will count only visible rows.
Criteria: The criteria you will count visible rows based on.
Vals.firstcell: The first cell of the range.

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

1) In the formula, D3:D15 is the range contains the visible rows to count, C18 contains the criteria you will count visible rows based on, and D3 is the first cell of the range. You can change them based on your own data.
2) If you did not enter the criteria in a cell in advance, you can directly enter it in the formula and enclose it in double quotes as follows.

=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 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 VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup... Adv. Drop-down List: Easy 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 Columns to Select Same & Different Cells ... 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 Toolsets:  12 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 Excel Cells ...)  |  ... and more

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.