MS Excel: DCOUNT Function (WS)
In Microsoft Excel, the DCOUNT function returns the number of cells in a column or database that contains numbers and meets a given criteria.
Syntax
The syntax for the DCOUNT function is:
DCOUNT( range, field, criteria )
range is the range of cells that you want to apply the criteria against.
field is the column to count the values. You can either specify the numerical position of the column in the list or the column label in double quotation marks.
criteria is the range of cells that contains your criteria.
Applies To
- Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Function
- Worksheet function (WS)
Worksheet Function Example
Let's take a look at an example to see how you would use the DCOUNT function in a worksheet:

Based on the Excel spreadsheet above, the DCOUNT function would return the following:
| =DCOUNT(A4:D8, "Unit Cost", A1:B2) | would return 2 |
| =DCOUNT(A4:D8, 3, A1:B2) | would return 2 |
| =DCOUNT(A4:D8, "Quantity", A1:A2) | would return 3 |
| =DCOUNT(A4:D8, 2, A1:A2) | would return 3 |
Using Named Ranges
You can also use a named range in the DCOUNT function. For example, we've created a named range called orders that refers to Sheet1!$A$4:$D$8.

Then we've entered the following data in Excel:

Based on the Excel spreadsheet above, the DCOUNT function would return the following:
| =DCOUNT(orders, "Total Cost", A1:B2) | would return 2 |
| =DCOUNT(orders, 4, A1:B2) | would return 2 |
To view named ranges: Under the Insert menu, select Name > Define.
