Quick Answer

DCOUNT Function

Counts numeric values in a database column for rows that meet the criteria.

✓ Excel✓ Google SheetsExcel All versions

Syntax

DCOUNT
(database, field, criteria)

Parameters

ParameterDescriptionRequired
databaseThe range containing the database, including the header row as the first row.Required
fieldThe column to count, given as the column label in quotes (e.g. "Yield") or its 1-based column index.Required
criteriaThe range with a header row matching database column names and one or more condition rows; only matching records are counted.Required

Basic Example

Count numeric Yield values for apple trees taller than 10

=DCOUNT(A1:E7, "Yield", A9:B10)
Result2

The criteria A9:B10 (Tree=Apple, Height>10) matches two rows, and both have numeric Yield values, so the count is 2.

Advanced Examples

Example 1: Count a column with blank or text cells

A field that mixes numbers and text

If the chosen field contained a text label in one matching row, DCOUNT would exclude it because only numbers are counted.

=DCOUNT(A1:E7, "Tree", A9:B10)
Result: 0
The Tree field holds text, not numbers, so DCOUNT returns 0 even though two rows match. DCOUNTA would count them instead.

Example 2: Count with a single condition

Count all apple-tree records with numeric Yield

Use criteria Tree=Apple across A9:A10.

=DCOUNT(A1:E7, "Yield", A9:A10)
Result: 3
Three apple rows exist (Yield 14, 10, 6), all numeric, so the count is 3.

How DCOUNT Works

DCOUNT filters the database to rows matching the criteria, then counts how many of those rows contain a numeric value in the specified field column. Empty cells and text in the field are not counted.

1
Set up the database
Enter your table with a header row, e.g. A1:E7 with Tree, Height, Age, Yield, Profit.
2
Set up criteria
Place criteria headers and values in a separate range, e.g. A9:B10.
3
Enter DCOUNT
Type =DCOUNT(A1:E7, "Yield", A9:B10) and press Enter.

Important Notes & Limitations

  • Counts only numeric cells; text and blank cells in the field are ignored.

  • Criteria header labels must exactly match database headers.

  • If you need to count non-numeric entries, use DCOUNTA.

Common Errors & Fixes

0 resultThe chosen field holds text, or no rows matched the criteria.

Fix: Use a numeric field, or switch to DCOUNTA for non-numeric entries.

#VALUE!The field was an unquoted column name.

Fix: Wrap the field name in quotes, e.g. "Yield", or use the column index.

Download Practice File

Practice DCOUNT with Real Data

Download a sample CSV file with pre-populated data and practice exercises for the DCOUNT function. Works in both Excel and Google Sheets.

Works in Google SheetsCompatible with ExcelIncludes exercises

File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps

Frequently Asked Questions

Does DCOUNT count text values?
No. Only numeric values in the field are counted. Use DCOUNTA to count any non-blank cell.
What does DCOUNT return if nothing matches?
It returns 0, because no numeric cells met the criteria.
How is DCOUNT different from COUNTIF?
DCOUNT filters a multi-column database by a full criteria range, while COUNTIF applies a single condition to one range.