Go Back

How to Use the Excel DCOUNT Function

Excel allows a user to count records from a database based on a given criteria, using the DCOUNT function. This step by step tutorial will assist all levels of Excel users in counting matching records from a database.

Figure 1. The result of the DCOUNT function

Syntax of the DCOUNT Formula

The generic formula for the DCOUNT function is:

=DCOUNT(database, field, criteria)

The parameters of the DCOUNT function are:

  • database – a table containing data
  • field – a field which value we want to get
  • criteria – a table containing conditions for selecting a result

While creating a criteria range, we must be sure to have the same header as in a database table.

Setting up Our Data for the DCOUNT Function

Figure 2. Data that we will use in the DCOUNT example

Let’s look at the structure of the data we will use. Our database table consists of 3 columns: “Delivery Number” (column B), “Delivery Date” (column C) and “Amount” (column D). The database range is B2:D9. The criteria range is B11:B12 and has the same header as the database. In the cell F3, we want to get the count of records in the database for the selected criteria.

Get the Count of Records Using the DCOUNT Function

In our example, we want to count how many records in the database have amount $1,000. The result is in the cell F3.

The formula looks like:

=DCOUNT(B2:D9, 3, B11:B12)

The database is the B2:D9 range, containing the database. The parameter field is 3 as we want to apply criteria on the third column (“Amount”). The range B11:B12 is the criteria parameter, containing the conditions for data selection.

To apply the DCOUNT function, we need to follow these steps:

  • Select cell F3 and click on it
  • Insert the formula: =DCOUNT(B2:D9, 3, B11:B12)
  • Press enter

Figure 3. Using the DCOUNT function to count matching records in the database

As we can see in Figure 3, rows 3 and 9 have amount $1,000. Finally, the result in the cell F3 is 2.

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

my nested dcount function is returning the wrong value it is returning 0 instead of no records found as specified in my if function
Solved by X. H. in 19 mins
A workbook contains a list of members in the Computer Club. You want to identify the number of students who are freshman who are Information Systems majors. Without filtering the dataset, what function do you use? (a) DCOUNT (b) COUNTA (c) DSUM (d) COUNT
Solved by I. J. in 27 mins
On the CallCenterReport worksheet, in cell G19, type Y. In cell J19, type Friday. Name the range A18:J19 Call_Criteria and in cell B22, add a DCOUNT function for the CallDataAll database to find the count of the satisfaction rating currently listed in cell B21 using the Call_Criteria named range.
Solved by I. S. in 12 mins

Leave a Comment