Database functions

DCOUNTA

Matches all 3 recorded answers

Recorded: 3 workbook cells. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicDCOUNTA
BulgarianDCOUNTA
CzechDPOČET2
DanishDTÆLV
GermanDCOUNTA
GreekDCOUNTA
English (Australia)DCOUNTA
English (United Kingdom)DCOUNTA
English (United States)DCOUNTA
SpanishBDCONTARA
EstonianDCOUNTA
FinnishTLASKEA
FrenchBDNBVAL
HebrewDCOUNTA
CroatianDCOUNTA
HungarianAB.DARAB2
IndonesianDCOUNTA
ItalianDCOUNTA
JapaneseDCOUNTA
KoreanDCOUNTA
LithuanianDCOUNTA
LatvianDCOUNTA
NorwegianDANTALLA
DutchDBAANTALALC
PolishBD.ILE.REKORDÓW.A
Portuguese (Brazil)DCOUNTA
Portuguese (Portugal)BDCONTAR.VAL
RomanianDCOUNTA
RussianБСЧЁТА
SlovakDCOUNTA
SlovenianDCOUNTA
Serbian (Latin)DCOUNTA
SwedishDANTALV
ThaiDCOUNTA
TurkishVSEÇSAYDOLU işlevi
UkrainianDCOUNTA
VietnameseDCOUNTA
Chinese (Simplified)DCOUNTA
Chinese (Hong Kong)DCOUNTA
Chinese (Traditional)DCOUNTA

Names from Microsoft's support site.

What it does

DCOUNTA(database, field, criteria)

DCOUNTA(database, field, criteria) selects the records of database that satisfy criteria and returns how many of them have a non-blank cell in the column named by field.

With R the set of selected record rows and c the resolved field column:

result = | { r in R : cell (r, c) is not blank } |

Numbers, text, and logicals all count as present. Only genuinely absent content — an empty cell, or an omitted value — is excluded.

If field is omitted, the column stage disappears and the function returns |R|, the count of matching records. In that mode DCOUNTA and DCOUNT return the same thing.

The selection stage — header matching, AND across a criteria row, OR down the rows, blank criteria cells, and criteria-expression parsing — is identical for all twelve database functions and is explained once in the criteria-range mechanism.

Arguments

Three argument slots; the reference implementation declares an arity of exactly 3.

  • database — the header-plus-records range or array.
  • criteria — the header-plus-conditions range or array.

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

Quirks

Result and edge cases

Returns a Number — a count, so always a non-negative integer.

  • No record matches: 0. No error on an empty selection.
  • Field omitted: the count of matching records.
  • Text in the field column counts, including text that reads as a number. This is the cleanest way to see the difference from DCOUNT: on a column of "1", "2", "3", DCOUNTA counts three and DCOUNT counts none.
  • Logicals count.
  • Arrays: inline array literals resolve to grids and are accepted; DCOUNTA is not a lift kernel.

Errors

ErrorCondition
#VALUE!database or criteria is not a grid or is empty; a database header cell is blank; a criteria header names no database field; a supplied field matches no header, or is a non-integer or out-of-range column index
propagatedAn error value in a header cell, a criteria cell, or a scanned field cell surfaces as that error

How to implement

Notes for implementers

  1. "Non-blank" is a value-kind test with one uncomfortable edge. Empty and the Missing marker are blank; every other core value kind — Number, Text, Logical — is present. Whether zero-length text belongs on the blank side is the one genuinely contested cell of that table, and it is unresolved here.
  2. Two code paths, one function. The omitted-field mode returns before any column is read, so a bad field value is undiagnosable in that mode. Resolve the field only when supplied.
  3. Errors are not "present". A scanned error surfaces instead of incrementing the count, which is a different decision from "count it as non-blank" and is easy to get wrong when the counting predicate is written as !is_blank(cell).
  4. Numeric criteria comparison is not exact double comparison — see the note in the shared mechanism.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

DCOUNTA · 1 lines · calc-func/src/catalogue/database.rs on GitHub
3 dcounta "DCOUNTA" (3, 3) [R "database", V "field", R "criteria"] |s, a, sv| { database(s, a, sv, Kind::CountA) }

Kernels shared with other functions

Argument and result plumbing

No implementation has been published with a Handbook test suite for this function.

Version differences

No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.

Alternatives

Relationships

  • DCOUNT is the number-counting sibling. The pair mirrors COUNT and COUNTA. These two are the only family members that accept an omitted field.
  • Nearest modern equivalent: COUNTIFS with a "<>" condition on the field column, which expresses "non-blank and matching" inline instead of through a criteria table.
  • Confused with: COUNTA (no selection stage), COUNTBLANK (the complement, and with a different treatment of ""), and DCOUNT.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents