ID EN
#Database

DCOUNT

Excel Functions

Count matching records in a database

Syntax

EXCEL
=DCOUNT(database, [field], criteria)

Arguments

Parameter Description
database Database range including headers.
field [optional] Field name or index to count.
criteria Criteria range including headers.

Return Value

Numeric count of matching records

Details

The Excel DCOUNT function counts matching records in a database using a specified field and criteria. The database argument is a range of cells that includes field headers, field is the name or index of the field to count, and criteria is a range of cells with headers matching those in database. Using the example above, you can count records where the color is "red" and price is > 10 with these formulas: Caution: if field is provided to the DCOUNT function, it is only counted when non-blank and numeric. If field contains a text value, or if the field is blank, it will not be counted, even when criteria match. The criteria can include a variety of expressions. The table below shows some examples: The criteria range for DCOUNT can include more than one row below the headers. When criteria in

Examples

Example 1

Using the example above, you can count records where the color is "red" and price is > 10 with these formulas:

EXCEL
=DCOUNT(B7:E14,"Total",B4:E5) // field by name
=DCOUNT(B7:E14,4,B4:E5) // field by index
=DCOUNT(B7:E14,,B4:E5) // field omitted

See Also

DCOUNTA DMAX DMIN DSUM DPRODUCT