Category: FUNCTION | Updated: 2026-11-22

How to Use the DCOUNT Function in Google Sheets | Count Numeric Cells Matching Criteria in a Database

Syntax

=DCOUNT(database, field, criteria)
  • database: Specifies the entire cell range of the data, including headers in the first row.
  • field: Specifies the header name of the column in which to count numbers, or its column number from the left.
  • criteria: Specifies the cell range containing the filter conditions (headers + condition values).

Practical Example with a Table

Here is an example of counting how many students in “Class A” (specified in criteria range E1:E2) have a numeric score entered in exam results (A1:C6), excluding text entries such as “Absent.”

Cell Range Role Contents
A1:C6 Database Row 1: Class, Name, Score / Rows 2–6: data for 5 students (1 entered as "Absent")
E1:E2 Criteria Range E1 = Class, E2 = A
Formula Cell Count Result =DCOUNT(A1:C6, "Score", E1:E2) → Outputs the number of Class A students with numeric scores

Common Errors and Notes

  • Text and Blank Cells Are Not Counted: If the target field contains text like "TBD" or "Absent", or is blank, DCOUNT excludes it from the count.
  • #VALUE! Error: Occurs if the field column name is misspelled or if the first row of the database range does not include headers.
  • Extra Spaces in Headers: Differences in leading/trailing spaces (half-width or full-width) between the database headers and criteria headers prevent proper matching.

Frequently Asked Questions

Q. What happens if I specify a text column in the DCOUNT function?

A. Because DCOUNT only counts cells containing "numbers," specifying a column with only text returns "0." If you want to count text values as well, use the DCOUNTA function.

Q. Can I count only the number of rows matching the criteria without targeting a specific numeric column?

A. Yes. By specifying a column that always contains a number (such as ID or Amount) as the field, you can accurately count the number of matching records.