Search Contextures Sites ![]()
Excel Count Functions -- Count Excel Cells
Count cells that match criteria -- COUNTIF
Count cells that match multiple criteria -- SUMPRODUCT
Match multiple criteria
In Excel, count rows that meet two or more criteria. In this example only the rows where the item is "Pen" and the quantity is greater than or equal to ten will be counted.
Count Rows in a Filtered List -- SUBTOTAL
After you filter the rows in a list, you can use the SUBTOTAL function to count the visible rows.
- Apply an AutoFilter to the table. There are instructions here -- AutoFilter Basics
- Filter at least one of the columns in the table. In this example, the first column has been filtered for Binders.
- Select the cell immediately below the column you want to sum.
- Click the AutoSum button on the Excel's Standard toolbar.
- If you want the SUBTOTAL function in a cell other than the one directly below the filtered list, you can type the formula, instead of using the AutoSum button.
- A SUBTOTAL formula will be automatically inserted, totalling the visible cells in the column
- The first argument in the SUBTOTAL function is a function number, that specifies how the numbers should be calculated. The default is 9, which tells Excel to SUM the numbers.
- Other function numbers can be used, such as 1 for AVERAGE, and 3 for COUNTA. Look in Excel's Help for a complete list.
- To Count all the non-empty cells in column D, use a 3 as the first argument:
=SUBTOTAL(3,D2:D10)
- Press the Enter key to complete the formula entry.
Note: In Excel 2003, you can use the formula:
=SUBTOTAL(103,D2:D10)
to subtotal rows which have been manually hidden, or filtered.
=SUBTOTAL(3,D2:D10)
Count Visible Items in a Filtered ListLaurent Longre created a formula that lets you work with visible rows after a filter. For information see, Power Formula Technique in this article at John Walkenbach's web site:
http://j-walk.com/ss/excel/eee/eee001.txtIncorporating that technique, SUMPRODUCT can be used to count visible items in a filtered table. In the following example, column D has been filtered for amounts greater than 100. The following formula will count the number of visible rows that contain "Pen" in column A.
- From the dropdown list in cell D1, select Custom.
- Filter for rows greater than 100.
- In cell A12, type: Pen
- In cell B12, enter the following formula:
![]()
=SUMPRODUCT(SUBTOTAL(3,OFFSET(A1:A10,ROW(A1:A10)
-MIN(ROW(A1:A10)),,1)), --(A1:A10=A12))
Excel Function Tutorials
Excel Sum Functions
Excel VLOOKUP Function
Excel INDEX / MATCH Functions
Excel Count Functions
Excel INDIRECT FunctionExcel Function Video Tutorials:
Contextures Inc., Copyright © 2009.
All rights reserved.
Search Contextures Sites ![]()
Download zipped sample Excel COUNT workbook
Last updated: January 28, 2010 0:50 AM