Database All versions ◉ 16 views

=DCOUNT()

Counts the cells that contain numbers in a field (column) of records in a list or database that match conditions that you specify. The field argument is optional. If field is omitted, DCOUNT counts all records in the database that match the criteria.

Applies To: Excel for Microsoft 365Excel for Microsoft 365 for MacExcel 2024Excel 2024 for MacExcel 2021Excel 2021 for MacExcel 2019Excel 2016
=DCOUNT(database, field, criteria)
Hover argument names in the table for details.
Output typeNumber
Popularity25 / 100
VolatileNo
Dynamic ArrayNo
Download sample .xlsx ▦ Try in Playground Dedicated file for this function — safe & lightweight · sample data + live formulas
Share:

⬇ Download Sample Workbook

A dedicated .xlsx for =DCOUNT() with Persian sample data & live formulas — open in Excel and practice.

  • Sheet “Sample” — data table + formula in place
  • Sheet “Guide” — syntax, arguments & tips from this page
  • Instant & secure (token + rate limit)
Download DCOUNT.xlsx ~ 8–12 KB · No macros

⇪ Share

Send this function to friends

Quiz this function

%d questions — syntax, example & errors — test yourself!

◧ Arguments

ArgumentTypeRequiredDescription
database Range Required The range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
field Any type Required Indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
criteria Range Required The range of cells that contains the conditions that you specify. You can use any range for the criteria argument, as long as the argument includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

▣ Examples

▦ Data
CellValue
A2 Tree
B2 Height
C2 Age
D2 Yield
E2 Profit
F2 Height
A3 ="=Apple"
B3 >10
F3 <16
A4 ="=Pear"
A5 Tree
B5 Height
C5 Age
D5 Yield
E5 Profit
A6 Apple
B6 18
C6 20
D6 14
E6 $105
A7 Pear
B7 12
C7 12
D7 10
E7 $96
A8 Cherry
B8 13
C8 14
D8 9
E8 $105
A9 Apple
B9 14
C9 N/A
D9 10
E9 $75
A10 Pear
B10 9
C10 8
D10 8
E10 $77
A11 Apple
B11 12
C11 11
D11 6
E11 $45
A12 Tree
B12 Height
C12 Age
D12 Yield
E12 Profit
F12 Height
A13 ="=Apple"
B13 >10
F13 <16
A14 ="=Pear"
A15 Tree
B15 Height
C15 Age
D15 Yield
E15 Profit
A16 Apple
B16 18
C16 20
D16 14
E16 $105
A17 Pear
B17 12
C17 12
D17 10
E17 $96
A18 Cherry
B18 13
C18 14
D18 9
E18 $105
A19 Apple
B19 14
C19 N/A
D19 10
E19 $75
A20 Pear
B20 9
C20 8
D20 8
E20 $77
A21 Apple
B21 12
C21 11
D21 6
E21 $45
Finds apple trees between a height of 10 and 16 and counts how many of the Age fields in those records contain numbers. =DCOUNT(A4:E10, "Age", A1:F2)
Result: 1

§ Remarks

  • You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label for specifying the condition. For example, if the range G1:G2 contains the column label Income in G1 and the amount $10,000 in G2, you could define the range as MatchIncome and use that name as the criteria argument in the database functions.
  • Although the criteria range can be located anywhere on the worksheet, do not place the criteria range below the list. If you add more information to the list, the new information is added to the first row below the list. If the row below the list is not blank, Microsoft Excel cannot add the new information.
  • Make sure that the criteria range does not overlap the list.
  • To perform an operation on an entire column in a database, enter a blank line below the column labels in the criteria range.

✦ Tips

  • You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label for specifying the condition. For example, if the range G1:G2 contains the column label Income in G1 and the amount $10,000 in G2, you could define the range as MatchIncome and use that name as the criteria argument in the database functions.
  • Although the criteria range can be located anywhere on the worksheet, do not place the criteria range below the list. If you add more information to the list, the new information is added to the first row below the list. If the row below the list is not blank, Microsoft Excel cannot add the new information.
  • Make sure that the criteria range does not overlap the list.
  • To perform an operation on an entire column in a database, enter a blank line below the column labels in the criteria range.

💬 Comments & Q&A 0 approved

🔒 Your comment will be published after review.

Share your thoughts — visible after admin approval

No comments yet — be the first!

✍️ Add comment / question

captcha
🔒 Your comment will be published after review.