DCOUNTA Function (LibreOffice Calc)
The DCOUNTA function counts non-blank entries in a database column that match a set of criteria. It is part of the database function family and supports structured, criteria-based filtering.
Verification status: Consult the documentation, examples and any stated test scope below. How formula examples are checked
Availability and version history
- Introduced: Documented by LibreOffice 26.8.1.1; original introduction not established.
- Availability: Supported in LibreOffice 26.8.1.1, verified against its function registry. This identifies a supported release, not a final working version.
- Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
- Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.
What the DCOUNTA Function Does
- Counts non-blank values in a specified database column
- Applies criteria-based filtering using a criteria range
- Supports multiple criteria columns
- Supports AND/OR logic via criteria layout
- Works with structured database ranges
It is designed to be flexible, structured, and ideal for mixed-type conditional counting.
Syntax
DCOUNTA(database; field; criteria)
Arguments
-
database:
A range where the first row contains column labels. -
field:
The column to count.- Use column label in quotes (recommended)
- Or use column index (1 = first column)
-
criteria:
A range containing column labels and one or more criteria rows.
Basic Examples
Assume a table in A1:C6:
| A (Name) | B (Age) | C (Status) |
|---|---|---|
| John | 25 | Active |
| Mary | 30 | Active |
| Alex | 22 | Inactive |
| John | 28 | |
| Mary | 35 | Active |
Criteria in E1:F2:
| Age | Status |
|---|---|
| >25 | Active |
Count non-blank Status values matching criteria
=DCOUNTA(A1:C6; "Status"; E1:F2)
Returns 2.
Count non-blank Name values matching criteria
=DCOUNTA(A1:C6; "Name"; E1:F2)
Returns 2.
Count using field index
=DCOUNTA(A1:C6; 3; E1:F2)
Counts non-blank values in column 3 (Status).
Advanced Examples
Count entries where Name = “John”
Criteria:
| Name |
|---|
| John |
Formula:
=DCOUNTA(A1:C6; "Name"; E1:E2)
Count entries where Status is non-blank
Criteria:
| Status |
|---|
| <>"" |
Formula:
=DCOUNTA(A1:C6; "Status"; E1:E2)
Count entries where Age is between 25 and 30
Criteria:
| Age |
|---|
| >=25 |
| <=30 |
Formula:
=DCOUNTA(A1:C6; "Name"; E1:E3)
OR logic (multiple rows)
Criteria:
| Status |
|---|
| Active |
| Inactive |
Formula:
=DCOUNTA(A1:C6; "Status"; E1:E3)
Count entries where Name begins with “M”
Criteria:
| Name |
|---|
| M* |
Formula:
=DCOUNTA(A1:C6; "Name"; E1:E2)
Count entries with dynamic criteria
=DCOUNTA(A1:C6; "Status"; H1:I2)
Where H1:I2 is generated by formulas.
Edge Cases and Behavior Details
DCOUNTA counts:
- Text
- Numbers
- Logical values
- Formulas returning non-blank values
DCOUNTA ignores:
- Blank cells
- Empty strings ""
- Errors in the target field
field can be:
- Column label
- Column index
- Cell containing label
criteria must include column labels
Exact match required.
criteria supports:
- Comparison operators
- Wildcards
- Multiple rows (OR)
- Multiple columns (AND)
Empty criteria → counts all non-blank values
DCOUNTA of an error in criteria → error returned
DCOUNTA of an error in database → error ignored
Common Errors and Fixes
DCOUNTA returns 0 unexpectedly
Cause:
- Criteria labels don’t match database labels
- Criteria misaligned
- Field name misspelled
- Criteria row blank
Fix:
- Ensure labels match exactly
- Ensure criteria range includes labels
Err:502 — Invalid argument
Occurs when:
- field is invalid
- database range malformed
Unexpected counts
Cause:
- Blank cells vs empty strings
- Criteria not applied
Fix:
- Use LEN(field)>0 in criteria for strict non-blank detection
Best Practices
- Use DCOUNTA when counting text + numbers
- Use DCOUNT when counting numbers only
- Keep criteria ranges small and clearly labeled
- Use wildcards for flexible text matching
- Use multiple criteria rows for OR logic
- Use multiple criteria columns for AND logic
- Use FILTER (modern Calc) for dynamic extraction
Related Patterns and Alternatives
- Use DCOUNT to count numeric values only
- Use COUNTIFS for simpler criteria without database structure
- Use DSUM, DAVERAGE, DMAX, DMIN for aggregation
- Use FILTER for dynamic row extraction
- Use REGEX or TEXTAFTER for text-based criteria preprocessing
By mastering DCOUNTA and its companion database functions, you can build powerful, structured, and criteria-driven data workflows in LibreOffice Calc.