DCOUNT function

DCOUNT counts cells in a database field that meet specified criteria, returning the total count of matching non-blank cells.

=DCOUNT(database, field, criteria)

Generate a DCOUNT formula

Describe what you need. The generator will reach for DCOUNT where DCOUNT is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How DCOUNT reads its arguments
databaserequiredfieldrequiredcriteriarequiredDCOUNT
ArgumentRequiredDescription
databaseRequiredA range including headers in the first row; typically a named range or table. DCOUNT searches through all data rows below the headers to find matches.
fieldRequiredThe column to count—specified by name as text (must match the header exactly) or by column position number. DCOUNT counts non-blank cells in this column only.
criteriaRequiredA range with headers matching the database, followed by one or more condition rows. DCOUNT counts cells where ALL criteria rows are satisfied simultaneously.

Returns

A non-negative integer representing the count of non-blank cells in the specified field that satisfy all criteria.

Availability

Excel: All · Google Sheets: Supported

Worked examples

1. Count inventory items in North warehouse

SKUWarehouseOn HandReorder PointCost
A001North1505012.50
A001South755012.50
A002North30608.75
A002South120608.75
A003North2004015.00
A003South354015.00
=DCOUNT($A$1:$E$6,"On Hand",$G$1:$G$2)

Result: 3

DCOUNT counts non-blank cells in the 'On Hand' column where Warehouse='North'. Three rows match this criteria (A001, A002, A003 in North), each with a non-blank On Hand value (150, 30, 200). The function returns 3.

2. Count items below reorder point

SKUWarehouseOn HandReorder PointCost
A001North1505012.50
A001South755012.50
A002North30608.75
A002South120608.75
A003North2004015.00
A003South354015.00
=DCOUNT($A$1:$E$6,"SKU",$G$4:$H$5)

Result: 2

Using criteria On Hand < Reorder Point, DCOUNT counts SKUs requiring reorder. Two items fall below their threshold: A002 North (30 < 60) and A003 South (35 < 40). DCOUNT returns 2 because exactly two SKU cells have non-blank values matching all criteria.

3. Count well-stocked, high-value items

SKUWarehouseOn HandReorder PointCost
A001North1505012.50
A001South755012.50
A002North30608.75
A002South120608.75
A003North2004015.00
A003South354015.00
=DCOUNT($A$1:$E$6,"SKU",$G$7:$H$8)

Result: 3

With criteria On Hand > Reorder Point AND Cost > 12, DCOUNT counts SKUs that are both well-stocked and expensive. Three rows qualify: A001 North (150>50, $12.50>$12), A001 South (75>50, $12.50>$12), and A003 North (200>40, $15.00>$12). DCOUNT returns 3.

Common errors

Which DCOUNT error are you seeing?
DCOUNT returned an error#NAME?
Ensure the field name matches a header exactly (case-sensitive in some systems). Use "On Hand" instead of "onhand" or "Qty On Hand" if the header is "On Hand".
#REF!
Redefine the database and criteria ranges to point to valid cells. Use absolute references ($A$1:$E$6) to prevent accidental breakage if rows/columns are inserted or deleted.
#VALUE!
Verify that criteria headers match database headers exactly and that each condition has valid syntax (e.g., ">50", "=North", "<", not just ">" alone).
ErrorWhy it happensHow to fix it
#NAME?The field parameter references a column name that does not exist in the database headers, or the name is misspelled.Ensure the field name matches a header exactly (case-sensitive in some systems). Use "On Hand" instead of "onhand" or "Qty On Hand" if the header is "On Hand".
#REF!The database or criteria range contains deleted cells, rows, or columns, breaking the reference.Redefine the database and criteria ranges to point to valid cells. Use absolute references ($A$1:$E$6) to prevent accidental breakage if rows/columns are inserted or deleted.
#VALUE!The criteria range structure is invalid—for example, criteria headers do not match any database headers, or the criteria logic uses invalid syntax like > without a value.Verify that criteria headers match database headers exactly and that each condition has valid syntax (e.g., ">50", "=North", "<", not just ">" alone).

Tips and when to use something else

  • Use DCOUNT when you need to count cells in a single column that match multiple criteria; for simpler single-criterion counts, COUNTIF is often faster and more readable.
  • DCOUNT counts non-blank cells only—blank cells are ignored even if they technically match the criteria. If you need to count all matching rows regardless of blanks, use SUMPRODUCT with conditional logic instead.
  • Criteria headers must be spelled exactly like database headers. DCOUNT is case-insensitive in most systems, but spelling and spacing must match precisely.
  • To count across multiple fields or with OR logic (e.g., 'Warehouse=North OR Warehouse=South'), use SUMPRODUCT or helper columns; DCOUNT only supports AND logic across criteria rows.

Frequently asked questions

How is DCOUNT different from COUNTA?
COUNTA counts all non-blank cells in a range. DCOUNT counts non-blank cells in a single database field that meet criteria rows you specify. DCOUNT requires criteria; COUNTA does not. Use DCOUNT when filtering by conditions, COUNTA when just counting non-empty cells.
Can I use DCOUNT with multiple conditions (AND logic)?
Yes. Add multiple columns to your criteria range with different conditions. DCOUNT returns a count only for rows where ALL criteria are satisfied. If Warehouse=North AND Cost>10, your criteria range has two header columns and one data row specifying both conditions.
What if DCOUNT returns 0?
No rows in the database matched all criteria, or all matching rows have blank cells in the field being counted. Verify your criteria are correct and that the field column contains data. Use a different field (like DCOUNTA instead) if you want to count matching rows even if that field is blank.
Why does my DCOUNT formula give a different result than COUNTIFS?
DCOUNT uses a separate criteria range with headers; COUNTIFS uses inline criteria ranges. Both work, but they expect different syntax. DCOUNT is older and more common in enterprise sheets; COUNTIFS is more modern. The logic should give the same count if both formulas express the same criteria correctly.

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator

Reviewed 2026-09-17