Database function

DCOUNTA function

Counts the non-empty cells in one column of a list for the records that match 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

DCOUNTA(database, [field], criteria)
ArgumentWhat it means
databaseRequiredThe list including its header row.
fieldOptionalThe column to check for non-empty cells, as a header in quotes or a column number. If omitted, all matching records are counted.
criteriaRequiredThe criteria range with headers and conditions.

Returns: How many matching records have something (number, text, logical value or error) in field.

How DCOUNTA works

DCOUNTA is the "count anything that isn't empty" member of the database functions. It is to DCOUNT what COUNTA is to COUNT: a matching record is counted when the chosen field contains any value — text, a number, TRUE/FALSE, even an error. Only truly empty cells are skipped.

That makes it the natural choice when the field holds text (names, codes, suppliers) or a mix of numbers and notes. A common trick is to count records by pointing the field at a column that is always filled, such as an item name or ID, so the result is simply the number of records that meet the criteria.

Examples

1Cable products with any stock entry

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

Result: 3

All three cables have something in the Stock column, including the text n/a, so DCOUNTA returns 3. DCOUNT with the same arguments returns 2.

2Count items with at least 40 in stock

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

Result: 3

Counting the Item column (always filled) gives the number of matching records: HDMI cable (120), Mouse (45) and Ethernet cable (80). The n/a text is not compared as a number, so it does not match.

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

Common errors and how to fix them

ErrorWhy it happensFix
#VALUE!The field name is not one of the list's headers.Use the exact header text or the column number.

Tips

  • A cell with a formula returning "" is not empty, so DCOUNTA counts it.
  • To count unique values among the matches, use UNIQUE with FILTER in Microsoft 365 instead.

Google Sheets

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

DCOUNTA 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ČET2
DanishDTÆLV
DutchDBAANTALC
FinnishTLASKEA
FrenchBDNBVAL
GermanDBANZAHL2
HungarianAB.DARAB2
ItalianDB.CONTA.VALORI
Norwegian (Bokmål)DANTALLA
PolishBD.ILE.REKORDÓW.A
Portuguese (Brazil)BDCONTARA
Portuguese (Portugal)BDCONTAR.VAL
RussianБСЧЁТА
SpanishBDCONTARA
SwedishDANTALV
TurkishVSEÇSAYDOLU