DCOUNT(database, field, criteria)
- Where 'database' is the range of cells that makes up the list or database
- 'field' shows which column is used in the function and
- 'criteria' is the range of cells that contains the specified criteria.
- DCOUNT() counts the numbers in the column of a list or database that match the specified criteria.
Description
DCOUNT(database, field, criteria)
It counts the cells that contain numbers in a listed column or database that match the specified condition.
- The argument 'field' is optional. If not mentioned, the function counts all the numbers from database that match the criteria.
- A 'column name' in quotes (e.g. "Salary") or 'column number' (e.g. 3, if Salary is 3rd column) can be used as 'field' argument.
- Criteria can be any range on the 'Calci' with minimum of one column and at least one row indicating the condition.
- The Criteria columns should not overlap the list of data.
- DCOUNTA() can be used to count the number of non-blank cells from a list of database that match a specified criteria.
Examples
Consider the following table with Employee names, Age and Salary columns. Row1 to Row3 has the criteria fields. Row4 to Row10 display the actual data.
Name | Age | Salary | Age |
<40 | >5000 | >32 | |
>30 | |||
Name | Age | Salary | |
John | 34 | 5500 | |
Bill | 35 | 6500 | |
Clark | 29 | 7000 | |
Bob | 45 | 9000 | |
Susan | 37 | 4000 | |
Jill | 45 | 8000 |
=DCOUNT(A4:C10,"Salary",A1:C2) : Counts the number of cells in the 'Salary' column, in the range A4 to C10, for the employees whose Age<40 and Salary>5000. Displays 3 as a result.
=DCOUNT(A4:C10,"Age",A1:C2) : Counts the number of cells in the 'Age' column, in the range A4 to C10, for the employees whose Age<40 and Salary>5000. Displays 3 as a result.
=DCOUNT(A4:C10,"Salary",A1:C3) : Counts the number of cells in the 'Salary' column, in the range A4 to C10, for the employees whose Age<40 and Salary>5000 in addition to employees whose Age>30. Displays 8 as a result.
=DCOUNT(A4:C10,"Salary",A1:C2)-DCOUNT(A4:C10,"Salary",A1:D2) : Counts the difference in the number of cells in the 'Salary' column for employees whose Age<40 and Salary>5000, and employees with 40<Age>32 and salary>5000, in the range A4 to C10. Displays 1 (3-2=1) as a result.
=DCOUNT(A4:C10,3,A1:C2) : Counts the number of cells in the 3rd column ('Salary'), in the range A4 to C10, for the employees whose Age<40 and Salary>5000. Displays 3 as a result.