Learn how the DCOUNT function can be used to total the values in a column of data that meet the set criteria.
DCOUNT Syntax and Arguments
The DCOUNT function is one of Excel’s database functions. This group of functions is designed to make it easy to summarize information from large tables of data. They do this by returning specific information based on one or more criteria chosen by the user.
These instructions apply to Excel 2019, 2016, 2013, 2010, Excel 2019 for Mac, Excel 2016 for Mac, Excel for Mac 2011, Excel for Microsoft 365, and Excel Online.
The syntax for the DCOUNT function is:
= DCOUNT (database, field, criteria)
All database functions have the same three arguments:
- Database: (required) Specifies the range of cell references containing the database. The field names must be included in the range.
- Field: (required) Indicates which column or field is to be used by the function in its calculations. Enter the argument either by typing the field name in quotes, such as “Radius” or enter the column number, such as 3.
- Criteria: (required) Lists the range of cells containing the conditions specified by the user. The range must include at least one field name from the database and at least one other cell reference indicating the condition to be evaluated by the function.
This example will use DCOUNT to find the total number of students enrolled in the first year of their college program.
Entering the Tutorial Data
- Enter the data table as seen in the image below into cells D1 to F15.
- Leave cell F5 blank. This is where the DCOUNT formula will be located. Cell E5 has the heading Total: to indicate the information we will be finding with DCOUNT.
- The field names in cells D2 to F2 will be used as part of the function’s Criteria argument.
Selecting the Criteria and Naming the Database
To get DCOUNT to only look at data for first-year students, enter the number 1 under the Year field name in row 3.
The tutorial does not include formatting steps. Information on worksheet formatting options is available in this Basic Excel Formatting Tutorial.
Enter the data table as seen in the image below into cells D1 to F15.
Leave cell F5 blank. This is where the DCOUNT formula will be located. Cell E5 has the heading Total: to indicate the information we will be finding with DCOUNT.
The field names in cells D2 to F2 will be used as part of the function’s Criteria argument.
Using a named range for large ranges of data such as a database can not only make it easier to enter this argument into the function, but it can also prevent errors caused by selecting the wrong range.
Named ranges are very useful if you use the same range of cells frequently in calculations or when creating charts or graphs.
- Highlight cells D6 to F15 in the worksheet to select the range.
- Click on the name box above column A in the worksheet.
- Type Enrollment into the name box to create the named range.
- Press the Enter key on the keyboard to complete the entry.
Opening the DCOUNT Dialog Box
A function’s dialog box provides an easy method for entering data for each of the function’s arguments.
Highlight cells D6 to F15 in the worksheet to select the range.
Click on the name box above column A in the worksheet.
Type Enrollment into the name box to create the named range.
Press the Enter key on the keyboard to complete the entry.
You can open the dialog box for the database group of functions by clicking on the function wizard button (fx) located next to the formula bar above the worksheet.
- Click on cell F5, which is the location where the results of the function will be displayed.
- Click on the fx button.
- Type DCOUNT in the Search for a Function window at the top of the dialog box.
- Click on the Go button to search for the function. The dialog box should find DCOUNT and list it in the Select a Function window.
- Click OK to open the DCOUNT function dialog box.
- Click on the Database line of the dialog box.
- Type the range name Enrollment into the line.
- Click on the Field line of the dialog box.
- Type the field name “Year” into the line. Be sure to include the quotation marks.
- Click on the Criteria line of the dialog box.
- Highlight cells D2 to F3 in the worksheet to enter the range.
- Click OK to close the DCOUNT function dialog box and complete the function.
Click on cell F5, which is the location where the results of the function will be displayed.
Click on the fx button.
Type DCOUNT in the Search for a Function window at the top of the dialog box.
Click on the Go button to search for the function. The dialog box should find DCOUNT and list it in the Select a Function window.
Click OK to open the DCOUNT function dialog box.
Click on the Database line of the dialog box.
Type the range name Enrollment into the line.
Click on the Field line of the dialog box.
Type the field name “Year” into the line. Be sure to include the quotation marks.
Click on the Criteria line of the dialog box.
Highlight cells D2 to F3 in the worksheet to enter the range.
Click OK to close the DCOUNT function dialog box and complete the function.
Get the Latest Tech News Delivered Every Day