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
| Language | Name in Excel |
|---|---|
| Arabic | DCOUNTA |
| Bulgarian | DCOUNTA |
| Czech | DPOČET2 |
| Danish | DTÆLV |
| German | DCOUNTA |
| Greek | DCOUNTA |
| English (Australia) | DCOUNTA |
| English (United Kingdom) | DCOUNTA |
| English (United States) | DCOUNTA |
| Spanish | BDCONTARA |
| Estonian | DCOUNTA |
| Finnish | TLASKEA |
| French | BDNBVAL |
| Hebrew | DCOUNTA |
| Croatian | DCOUNTA |
| Hungarian | AB.DARAB2 |
| Indonesian | DCOUNTA |
| Italian | DCOUNTA |
| Japanese | DCOUNTA |
| Korean | DCOUNTA |
| Lithuanian | DCOUNTA |
| Latvian | DCOUNTA |
| Norwegian | DANTALLA |
| Dutch | DBAANTALALC |
| Polish | BD.ILE.REKORDÓW.A |
| Portuguese (Brazil) | DCOUNTA |
| Portuguese (Portugal) | BDCONTAR.VAL |
| Romanian | DCOUNTA |
| Russian | БСЧЁТА |
| Slovak | DCOUNTA |
| Slovenian | DCOUNTA |
| Serbian (Latin) | DCOUNTA |
| Swedish | DANTALV |
| Thai | DCOUNTA |
| Turkish | VSEÇSAYDOLU işlevi |
| Ukrainian | DCOUNTA |
| Vietnamese | DCOUNTA |
| 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
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",DCOUNTAcounts three andDCOUNTcounts none. - Logicals count.
- Arrays: inline array literals resolve to grids and are accepted;
DCOUNTAis not a lift kernel.
Errors
| Error | Condition |
|---|---|
#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 |
| propagated | An error value in a header cell, a criteria cell, or a scanned field cell surfaces as that error |
How to implement
Notes for implementers
- "Non-blank" is a value-kind test with one uncomfortable edge. Empty and the
Missingmarker 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. - 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.
- 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). - 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 GitHub3 dcounta "DCOUNTA" (3, 3) [R "database", V "field", R "criteria"] |s, a, sv| { database(s, a, sv, Kind::CountA) }
Kernels shared with other functions
readercatalogue/aggregateread_referencecatalogue/aggregatenumberscatalogue/comparisonin_bandcatalogue/comparisonRounded::upcatalogue/comparisonRoundings::ofcatalogue/comparisonRoundings::disjointcatalogue/comparisontextscatalogue/comparisoncomparecatalogue/comparison/collationweighedcatalogue/comparison/collationmeasured_iteration_extensioncatalogue/comparison/collationtablecatalogue/comparison/sort_keydecode64catalogue/comparison/sort_keyReader::bytecatalogue/comparison/sort_keyReader::varintcatalogue/comparison/sort_keyReader::donecatalogue/comparison/sort_keyin_rangescatalogue/comparison/sort_keybuildcatalogue/comparison/sort_keyhan_basecatalogue/comparison/sort_keyderivecatalogue/comparison/sort_keyshared_jamo_tailscatalogue/comparison/sort_keyordinary_jamo_prefixcatalogue/comparison/sort_keyindependent_jamo_suffixcatalogue/comparison/sort_keyjamo_leading_primarycatalogue/comparison/sort_keyleading_ordercatalogue/comparison/sort_keyBefore::separate_specialcatalogue/comparison/sort_keyGathered::kanacatalogue/comparison/sort_keyGathered::unitcatalogue/comparison/sort_keypartscatalogue/comparison/sort_keydiacritic_ordercatalogue/comparison/sort_keydiacriticscatalogue/comparison/sort_keyrangecatalogue/conditionalrowcatalogue/conditionaloffsetcatalogue/conditionalread_rangecatalogue/conditionalverdictscatalogue/conditionalusedcatalogue/conditionalMatch::ofcatalogue/conditionalMatch::negatedcatalogue/conditionalOp::holdscatalogue/conditionalOp::is_equalitycatalogue/conditionalspellscatalogue/conditionalcriterioncatalogue/conditionaldatabase_criterioncatalogue/conditionalrankcatalogue/conditionalcriterion_textcatalogue/conditionaldecidedcatalogue/conditionalCriterion::verdictcatalogue/conditionalequalitycatalogue/conditionalis_surrogatecatalogue/conditionalwildcardcatalogue/conditionallabelcatalogue/databasesame_labelcatalogue/databasefieldcatalogue/databasematchingcatalogue/databasecriterion_verdictcatalogue/databasedatabasecatalogue/databasepublishedcatalogue/databaselow32decimalNatural::from_u64decimalNatural::pow10decimalNatural::normalizedecimalNatural::is_zerodecimalNatural::mul_add_smalldecimalNatural::times_pow10decimalNatural::times_pow5decimalNatural::times_pow2decimalExactDecimal::binarydecimalexcel_sqrt_stagedported/excel_numerictextported/text_kernelstext_from_strported/text_kernelsfold_unitported/text_kernelspush_singleton_or_originalported/text_kernelspush_lowerported/text_kernelslowerported/text_kernelsvariance_from_valuesported/variance_commonstdev_from_valuesported/variance_common
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
COUNTandCOUNTA. These two are the only family members that accept an omitted field. - Nearest modern equivalent:
COUNTIFSwith 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""), andDCOUNT.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents