DCOUNT Function (OpenOffice Calc)
Use DCOUNT in Apache OpenOffice Calc to count matching records whose selected field contains a number. Includes criteria examples, expected results and compatibility notes.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in OpenOffice Calc. How formula examples are checked
Quick answer
Use DCOUNT in Apache OpenOffice Calc to count matching records whose selected field contains a number. With the data and Team 1 criteria below, =DCOUNT($A$1:$F$7;"Score";H1:H2) has an independently checked expected result of 4 numeric cells.
Use DCOUNT to audit how many measurements contributed to a filtered calculation. It is more specific than counting rows: a matching record with a blank or text-valued target field does not supply a numeric observation. The official Apache OpenOffice Calc reference documents this database function. Here, “database” means a rectangular worksheet range with a header row; it does not require a database server.
Exact syntax and parameters
=DCOUNT(database;field;criteria)
Database: include the headers as well as the data, for example $A$1:$F$7. One row represents one record. Do not start at row 2 and accidentally treat the first record as the header.
Field: identify the column to calculate, such as "Score". A column number is counted from the left edge of the database, starting at 1; it is not a worksheet column letter. The field being calculated can differ from the field used to filter records.
Criteria: supply a separate cell range containing matching column headings and the conditions below them. Conditions on the same row mean AND; separate condition rows mean OR. A record satisfying more than one alternative is still one selected record. The examples always provide all three arguments and do not depend on omitted-field behaviour.
Apache’s English Calc Help uses semicolons. These examples follow that notation, not Excel’s comma-separated examples. Localized names and separators may differ; follow your installed Function Wizard or formula editor. The examples deliberately use numeric Team/Class codes to avoid assuming identical text-pattern settings between programs.
Practice data and layout
Open a blank worksheet. Enter the six headers ID, Team, Class, Score, Factor, Note in A1:F1, then enter the records below in A2:F7. F3 must be truly empty: do not type the words “leave empty.” Place criteria to the right of the database and results in column K, so no result overwrites an input.
| Row | A: ID | B: Team | C: Class | D: Score | E: Factor | F: Note |
|---|---|---|---|---|---|---|
| 2 | 101 | 1 | 1 | 10 | 2 | Ready |
| 3 | 102 | 1 | 2 | 20 | 3 | leave empty |
| 4 | 103 | 2 | 1 | 30 | 4 | Hold |
| 5 | 104 | 1 | 1 | 40 | 5 | Ready |
| 6 | 105 | 2 | 2 | 50 | 6 | Ready |
| 7 | 106 | 1 | 2 | 0 | 1 | Hold |
Download the input CSV. This CSV contains the six-column input table only, not formulas or prefilled criteria. Import at A1 and keep the empty Note field empty. The same fixture is used in the companion program guide to make cross-software comparisons reproducible.
Worked examples: one condition, AND and OR
Example 1 — select Team 1
Put Team in H1 and the number 1 in H2. In K2 enter:
=DCOUNT($A$1:$F$7;"Score";H1:H2)
Expected result: 4. The selected IDs are 101, 102, 104, 106. Team 1 has four numeric scores: 10, 20, 40 and 0. DCOUNT therefore returns 4, not 3. A numeric zero is still a number. Counting the Note field instead gives 0 here because its populated entries are text.
Example 2 — Team 1 AND Class 1
Enter H5=Team, I5=Class, H6=1, I6=1. Both tests are in the same criteria row, so a record must pass both. Enter in K6:
=DCOUNT($A$1:$F$7;"Score";H5:I6)
Expected result: 2. Only IDs 101 and 104 match. Compare those two source records with the result, rather than counting every Team 1 record or every Class 1 record independently.
Example 3 — Team 2 OR Score at least 40
Enter H9=Team, I9=Score, H10=2, leave I10 and H11 empty, and type >=40 in I11. These are two alternative criteria rows. In K10 enter:
=DCOUNT($A$1:$F$7;"Score";H9:I11)
Expected result: 3. The selected IDs are 103, 104 and 105. Record 105 meets both alternatives but is included only once. This is why adding two separate aggregates can give a different answer when their conditions overlap.
Advanced example — two bounds on the same field
Use the header Score twice, in H14 and I14. Type >=20 in H15 and <=40 in I15. Repeated headings let you express a lower and upper bound on one field within the same AND row. In K15 enter:
=DCOUNT($A$1:$F$7;"Score";H14:I15)
Expected result: 3. The selected IDs are 102, 103 and 104. The bounds are inclusive. Putting the two bounds on different rows would express OR and would select a different set of records.
Interpret the result correctly
The field being counted does not have to be the field being filtered. Criteria can select Team 1 while DCOUNT counts numbers in Score. Counting a text identifier column is not a reliable way to obtain a record count; use a known numeric ID field or DCOUNTA on a reliably populated field.
Compare DCOUNT and DCOUNTA when checking imported data. In this fixture, Team 1 has four numeric Score values but only three populated Note cells. This is a difference in the target fields, not a failure of the criteria.
For a direct Note-field comparison, =DCOUNTA($A$1:$F$7;"Note";H1:H2) has expected result 3 under the Team 1 criterion.
Troubleshooting and scope
If a result looks wrong, check the selected record IDs before changing the arithmetic. A heading typed differently from the database header, a criteria range lacking its header, or a condition placed on the wrong row changes the selection. Keep criteria ranges tight: accidentally including an entirely empty alternatives row can undermine the intended restriction.
Inspect numeric inputs as numbers, not imported text with currency symbols or hidden spaces. These examples use valid numbers and one genuinely empty Note cell. They do not establish how every blank, formula-generated empty string, boolean, error cell or numeric-looking text is coerced in every release.
Apache Calc’s help explicitly notes that calculation settings affect identical-entry searches and includes regular-expression guidance. Do not copy Excel wildcard assumptions into a text-criteria worksheet without checking those settings. For DCOUNT, Apache documents a nonempty field parameter; the examples use a header rather than its special field-zero option. For large or changing data, expand the database range deliberately to include new rows. Absolute references such as $A$1:$F$7 prevent copying from shifting the range, but they do not make the range grow automatically.
Compatibility and related functions
The Gnumeric DCOUNT guide uses the same input data and record-selection examples. The two official references document the same broad purpose and three-part database/field/criteria structure. That is not proof of identical error tokens, text matching, numeric coercion or file-format round trips. Start with these ordinary numeric cases, then test your actual workbook in each destination program.
Related Apache OpenOffice Calc functions: DCOUNTA, DAVERAGE, DSUM, DGET. Choose a different aggregate when the question changes rather than interpreting every numeric output as a total or a count.
How this guide was checked
Official references reviewed on 2026-10-12: Apache OpenOffice Calc database-function documentation and the companion program’s documentation. Argument order, header-based selection and the function’s purpose were checked against those references. The worked dataset, selected IDs and arithmetic are original examples, independently evaluated with a small Python model.
No native application run: these are expected results, not outputs observed in an installed Apache OpenOffice Calc application. No claim is made about the earliest release supporting the function or every platform. The documentation checked is English desktop-function documentation, not a mobile compatibility guarantee. Example-check record · Editorial standards.