Formualizer Docs

DCOUNT

Counts numeric cells in a database field for records matching criteria.

DCOUNT ignores non-numeric values in the selected field even when the row itself matches.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=DCOUNT(database, field, criteria)

Arguments

ArgumentTypeRequiredDefault
databaseanyRequired—
fieldanyRequired—
criteriaanyRequired—

Remarks

  • An equality criterion for a date or number ("10/26/1999", "36459", 36459) also matches text cells holding that date; <> and ordering criteria do not read date text.
  • Criteria rows are ORed, and criteria columns inside a single row are ANDed.
  • Only numeric field values contribute to the count.

Error cases

  • field header lookup is case-insensitive, and numeric field uses 1-based indexing; unresolved headers or invalid indexes return #VALUE!.

Examples

Count the numeric values in the Score column for the two East records.

Formula =DCOUNT(A1:B4,"Score",D1:D2)

Input cells
ABD
1"Team""Score""Team"
2"East"8"East"
3"West"3
4"East"10

Expected result 2

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Use field number 2 to get the same numeric count for East.

Formula =DCOUNT(A1:B4,2,D1:D2)

Input cells
ABD
1"Team""Score""Team"
2"East"8"East"
3"West"3
4"East"10

Expected result 2

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

With the West filter, only the score of 3 contributes to the numeric count.

Formula =IFERROR(DCOUNT(A1:B4,"Score",E1:E2),"Insufficient data")

Input cells
ABE
1"Team""Score""Team"
2"East"8"West"
3"West"3
4"East"10

Expected result 1

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

The missing field header prevents calculating the numeric count for East.

Formula =DCOUNT(A1:B4,"Missing",D1:D2)

Input cells
ABD
1"Team""Score""Team"
2"East"8"East"
3"West"3
4"East"10

Expected result #VALUE!

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Count numeric revenue entries in East region

Formula =DCOUNT(A1:E7, "Revenue", G1:G2)

Input cells
ABCDEG
1"Region""Salesperson""Product""Units""Revenue""Region"
2"West""Diaz""Widget"24126000"East"
3"East""Patel""Gadget"31142500
4"North""Kim""Widget"1887000
5"West""Ramos""Service"1246000
6"South""Lee""Gadget"27119000
7"East""Noor""Widget"22101000

Expected result 2

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Count numeric units for Widget or Service products

Formula =DCOUNT(A1:E7, 4, G1:G3)

Input cells
ABCDEG
1"Region""Salesperson""Product""Units""Revenue""Product"
2"West""Diaz""Widget"24126000"Widget"
3"East""Patel""Gadget"31142500"Service"
4"North""Kim""Widget"1887000
5"West""Ramos""Service"1246000
6"South""Lee""Gadget"27119000
7"East""Noor""Widget"22101000

Expected result 4

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

Does DCOUNT count text values that look like numbers?

Only values resolved as numeric in the target field are counted; true non-numeric text is ignored.

Implementation

Engine source

On this page