DCOUNT Function

Counts the numbers in a column for the records that match your criteria.

Category

Database

Available in

All versions, Microsoft 365

Returns

A whole number

Want to practice DCOUNT in a real spreadsheet? Open a blank sheet in our Practice Sandbox and try it with live data, with the AI Excel tutor beside you. No Excel needed — just a free account.Try it free in the Sandbox

Overview

DCOUNT counts matching records, but only where the field column holds a number. Point it at a numeric column such as Units or Sales.

Leave the field out — DCOUNT(database,,criteria) — to count every matching record.

Syntax

=DCOUNT(database, [field], criteria)

Arguments

ArgumentRequired?What it does
databaseYesThe whole list, including the header row — e.g. A1:E7. Each row is a record, each column a field.
fieldOptionalThe column whose numbers are counted. Leave it empty (two commas) to count all matching records.
criteriaYesA small range with at least one header copied exactly from the list and the conditions underneath, e.g. G1:G2.

Examples

Example 1 — How many large Toner orders?

Toner orders with Sales over 400.

G5fx=DCOUNT(A1:E7,"Sales",G1:H2)
ABCDEFGH
1RegionRepProductUnitsSalesProductSales
2NorthAmaraPaper40520Toner>400
3SouthBenToner12576
4NorthChloeToner8384Orders
5EastDevPaper253251
6NorthAmaraPens100120
7SouthEllaPaper30390
=DCOUNT(A1:E7,"Sales",G1:H2) Explain

Example 2 — Count records without choosing a field

How many orders came from the North?

G5fx=DCOUNT(A1:E7,,G1:G2)
ABCDEFG
1RegionRepProductUnitsSalesRegion
2NorthAmaraPaper40520North
3SouthBenToner12576
4NorthChloeToner8384Orders
5EastDevPaper253253
6NorthAmaraPens100120
7SouthEllaPaper30390
=DCOUNT(A1:E7,,G1:G2) Explain

Common mistakes

  • 0 when you pointed at a text column. DCOUNT only counts numbers. To count text entries (like Rep names) use DCOUNTA.

Notes

  • Criteria rules: conditions on the same row must all be true (AND); conditions on separate rows are alternatives (OR). Text such as Nor matches anything that begins with it — type ="=North" for an exact match. Use >500, <>East, or wildcards like *Paper*.
  • Modern equivalent: =COUNTIFS(C2:C7,"Toner",E2:E7,">400").
  • Related functions: DSUM, DAVERAGE, DCOUNT, DCOUNTA, DGET, DMAX, DMIN, DPRODUCT, DSTDEV, DSTDEVP, DVAR, DVARP.
Kyle Stott

Author

Kyle Stott

Certified Microsoft Excel Expert

Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.