DCOUNTA function

Counts non-empty cells in a specified database column for all rows matching your filter criteria, returning the total count.

=DCOUNTA(database, field, criteria)

Generate a DCOUNTA formula

Describe what you need. The generator will reach for DCOUNTA where DCOUNTA is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How DCOUNTA reads its arguments
databaserequiredfieldrequiredcriteriarequiredDCOUNTA
ArgumentRequiredDescription
databaseRequiredThe table range including headers in the first row and data rows below; must be rectangular.
fieldRequiredEither a column number (1-based, where 1 is the first column) or the header name as text (e.g., "Task" or "Hours Logged").
criteriaRequiredA range with headers in the first row matching database headers, and condition rows below specifying which records to include.

Returns

A number representing how many non-empty cells exist in the target field across all rows that meet all criteria.

Availability

Excel: All · Google Sheets: Supported

Worked examples

1. Count tasks assigned to a specific owner

TaskOwnerStart DateDue DateHours Logged
API AuthAlex1/5/20251/15/202516
DashboardBlake1/10/20251/20/202524
API AuthCasey1/5/20251/15/202512
ReportsAlex1/12/20251/25/20258
Owner
Alex
=DCOUNTA(A1:E5,"Task",A7:B8)

Result: 2

The formula counts non-empty cells in the Task column where Owner equals Alex. Two rows match: API Auth (row 2) and Reports (row 5), each with a task name. The result is 2.

2. Count logged hours for a single team member

TaskOwnerStart DateDue DateHours Logged
API AuthAlex1/5/20251/15/202516
DashboardBlake1/10/20251/20/202524
API AuthCasey1/5/20251/15/202512
ReportsAlex1/12/20251/25/20258
Owner
Casey
=DCOUNTA(A1:E5,"Hours Logged",A7:B8)

Result: 1

The criteria filter for Owner=Casey returns only row 4. The Hours Logged column in that row contains 12 (a non-empty cell). The count is 1.

3. Count deliverables in a date range using compound criteria

TaskOwnerStart DateDue DateHours Logged
API AuthAlex1/5/20251/15/202516
DashboardBlake1/10/20251/20/202524
API AuthCasey1/5/20251/15/202512
ReportsAlex1/12/20251/25/20258
Due Date
>1/15/2025
<=1/25/2025
=DCOUNTA(A1:E5,"Task",A7:B9)

Result: 2

The criteria require due dates after 1/15/2025 AND on or before 1/25/2025. Dashboard (due 1/20) and Reports (due 1/25) match. Both rows have task names, so the count is 2.

Common errors

Which DCOUNTA error are you seeing?
DCOUNTA returned an error#VALUE!
Reduce the field number to match actual columns (1–5 in this case), or switch to using the header name as text.
#N/A
Copy the exact header text from the database, including capitalization and all spacing.
#REF!
Undo the deletion, or rewrite the formula with the current valid range addresses.
ErrorWhy it happensHow to fix it
#VALUE!The field argument is a number exceeding the database column count (e.g., specifying field=6 when the database has only 5 columns).Reduce the field number to match actual columns (1–5 in this case), or switch to using the header name as text.
#N/AThe field argument as text doesn't match any header in the database's first row exactly (e.g., "Hours" instead of "Hours Logged", or extra spaces).Copy the exact header text from the database, including capitalization and all spacing.
#REF!A row or column referenced in the database or criteria range has been deleted, breaking the range address.Undo the deletion, or rewrite the formula with the current valid range addresses.

Tips and when to use something else

  • DCOUNTA counts all non-empty cells (text, numbers, dates, formulas); use DCOUNT if you only need numeric values.
  • Criteria headers must match database headers exactly—typos, capitalization, or extra spaces cause #N/A errors.
  • Prefer field names ("Task") over column numbers (1) for readability and resilience when columns are inserted or moved.
  • For a single simple condition, COUNTIF is faster than setting up a criteria range—only use DCOUNTA for multiple conditions.

Frequently asked questions

How does DCOUNTA differ from DCOUNT?
DCOUNTA counts any non-empty cell (text, numbers, dates, blanks-as-formulas), while DCOUNT counts only numeric values. Choose based on your data type.
Can I combine multiple conditions with DCOUNTA?
Yes. Add columns to the criteria range for each condition. All criteria in the same row must be true (AND logic), and DCOUNTA counts only matching rows.
What happens if a field cell is empty?
DCOUNTA only counts non-empty cells, so empty cells in the target field are skipped. If all matching rows have empty cells in the target field, the result is 0.
Can I use wildcards in criteria?
Yes. Criteria support wildcards like "*" (any characters) and "?" (single character), so "API*" matches "API Auth" and "API Token". Use "~" to escape wildcards literally.

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator

Reviewed 2026-09-17