Database function

DCOUNT function

Counts the cells containing numbers in one column of a list, for the records that meet the conditions in a criteria range.

Available in All versions of Excel, including Microsoft 365 and Excel for the web

In every Excel versionWorks in Google Sheets

Syntax

DCOUNT(database, [field], criteria)
ArgumentWhat it means
databaseRequiredThe list including its header row.
fieldOptionalThe column whose numbers are counted, as a header in quotes or a column number. If left out (DCOUNT(A1:D7,, F1:F2)), every matching record is counted.
criteriaRequiredThe criteria range: headers in the first row, conditions below.

Returns: How many matching records have a number in field.

How DCOUNT works

DCOUNT counts matching records, but with a twist: when you name a field, it only counts records where that field holds a number. Text, empty cells and errors in that column are skipped. That makes it the database-function equivalent of COUNT combined with conditions, and handy for questions like "how many cable products have a real stock figure?".

Like the other D-functions, DCOUNT reads its conditions from a criteria range on the sheet: headings matching the list, with conditions under them. Conditions in the same row combine with AND, separate rows combine with OR. If you want to count matching records regardless of what the field contains, use DCOUNTA (counts non-empty cells) or leave out the field argument.

Examples

1Cable products with a numeric stock figure

F2fx=DCOUNT(A1:D7, "Stock", A9:A10)
ABCDEF
1ItemCategoryStockSupplier
2HDMI cableCables120Volt2
3USB-C cableCablesn/aVolt
4MouseInput45Clicko
5KeyboardInput0Clicko
6Ethernet cableCables80NetPro
7WebcamVideo15Lumo
8
9Category
10Cables

Result: 2

Three items are cables, but the USB-C cable's stock is the text n/a. DCOUNT only counts numbers, so the answer is 2 — a quick sign that one record needs a proper stock count.

2How many items are running low?

F2fx=DCOUNT(A1:D7, "Stock", A9:A10)
ABCDEF
1ItemCategoryStockSupplier
2HDMI cableCables120Volt2
3USB-C cableCablesn/aVolt
4MouseInput45Clicko
5KeyboardInput0Clicko
6Ethernet cableCables80NetPro
7WebcamVideo15Lumo
8
9Stock
10<20

Result: 2

The keyboard (0) and the webcam (15) have fewer than 20 units, so the count is 2.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 14 KB

Common errors and how to fix them

ErrorWhy it happensFix
#VALUE!The field name does not match a header in the list.Check the spelling, or use the column number.
Unexpectedly low countValues in the field are numbers stored as text.Convert them with VALUE or use DCOUNTA.

Tips

  • For simple counts with one or two conditions COUNTIFS needs no criteria range; DCOUNT shines when users should edit the conditions in cells, or when you need OR across fields.
  • The criteria range can sit on a different sheet — a tidy way to build a filter panel.

Google Sheets

DCOUNT also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

DCOUNT in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
CzechDPOČET
DanishDTÆL
DutchDBAANTAL
FinnishTLASKE
FrenchBDNB
GermanDBANZAHL
HungarianAB.DARAB
ItalianDB.CONTA.NUMERI
Norwegian (Bokmål)DANTALL
PolishBD.ILE.REKORDÓW
Portuguese (Brazil)BDCONTAR
Portuguese (Portugal)BDCONTAR
RussianБСЧЁТ
SpanishBDCONTAR
SwedishDANTAL
TurkishVSEÇSAY