DCOUNT Function

Excel 2007+

Summary

The Excel DCOUNT function counts numeric values in a specified field of a database that match given criteria. It's designed for database-style operations where data is organized with column headers, enabling conditional counting of records containing numbers only.

Syntax

DCOUNT(database, field, criteria)

Parameters

Parameter Type Required Description
database Range Yes Range of cells that forms the database with headers in first row
field String/Number Yes Column label in quotes or numeric position (1-based)
criteria Range Yes Criteria range with matching column labels and conditions

Using the DCOUNT Function

DCOUNT excels at analyzing structured database tables by counting numeric entries that meet specific conditions. Create a criteria range with column headers and conditions below, then DCOUNT will scan your database and return the count of numeric values in the target field for matching records.

Common DCOUNT Examples

Count Apple Trees by Age

=DCOUNT(A4:E10, "Age", A1:F2)

Counts numeric Age values for Apple trees with Height >10 and <16. Returns 1 since only one matching record has a number in Age field.

Count All Matching Records

=DCOUNT(A4:E10, "Yield", A12:B13)

Counts Yield field numbers where Tree="Pear". Omits text or blank cells.

Frequently Asked Questions

Field is required in DCOUNT syntax. Use DCOUNTA if you need to count all matching records regardless of content.

No, DCOUNT ignores blanks, text, and errors - only numeric values are counted.

Yes, criteria can contain formulas like =">100" or ="<>Apple" for complex conditions.

Common Errors and Solutions

#VALUE!

Cause: Field name doesn't match database headers exactly

Solution: Verify field name spelling and case; use column number instead

#REF!

Cause: Database or criteria ranges are invalid

Solution: Ensure ranges exist and don't overlap

Unexpected count

Cause: Criteria range placed below database list

Solution: Move criteria above or to side of database

Notes

  • Only counts actual numbers - ignores text, blanks, errors
  • Case-insensitive text matching in criteria
  • Criteria cannot overlap database range
  • Supports wildcards (*, ?) in text criteria
  • Maximum criteria complexity: multiple rows with OR logic

Compatibility

Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Excel 2024, Excel for Microsoft 365, Excel for the web

Not available in:

Content last reviewed: December 11, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+