## What is DCOUNT Function in Excel?

The **DCOUNT **function is one of the **Database** functions of Excel.

It counts the cells containing numbers in the field (column) of **records **in the database that match the conditions you specify.

We can find this function in the **Database** of the insert function Tab.

## How to use **DCOUNT** function in excel

- Click on an
**empty**cell (like F5 )

2. Click on the **fx **icon (or press** shift+F3**)

3. In **insert function** tab you will see all functions

4. Select **Database** category

5. Select **DCOUNT** function

6. Then select **ok**

7. In the function arguments Tab you will see **DCOUNT **function

8. In the **Database section** you can enter the **range of cells** that makes up the list or database. A database is a list of related data (ex: Table1)

9. **Field section** is either the label of the column in double quotation marks or a number that represents the column’s position in the list (ex: C1)

10. **Criteria section** is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition (ex: Table1)

11. You will see the **result **in formula result section

## Examples of **DCOUNT** function in excel

**Example1:**

### calculate the number of student age=29 with **DCOUNT** function in excel

`=`**DCOUNT** **(Table3[#All],"Age",B1:B2)**----->>>>answer is 2

**Example2:**

### calculate the number of student Weight=231 with **DCOUNT** function in excel

`=`**DCOUNT** **(Table3[#All],"Weight",D1:D2)**----->>>>answer is 1

**Example3:**

### Calculate the number of Names include “n” with **DCOUNT** function in excel

we can use “*n” sign to find names that include “n”.

`=`**DCOUNT** **(Table3[#All],"age",A1:D2)**----->>>>answer is 4

**Example4:**

### Calculate the number of Names begins with “n” by **DCOUNT** function in excel

we can use “n*” sign to find names that begins with “n”.

`=`**DCOUNT** **(Table3[#All],"age",A1:D2)**----->>>>answer is 3

**Example 5:**

### Calculate the number of Row that is not blank by **DCOUNT** function in excel

we can use “<>” sign to find numbers of Row that is not blank .

`=`**DCOUNT** **(Table3[#All],"age",A1:D2)**----->>>>answer is 9

**Example 6:**

### Calculate the number of persons that “age>27” by **DCOUNT** function in excel

we can use “>27” sign to find numbers of persons that “age>27” .

`=`**DCOUNT** **(Table3[#All],"age",A1:D2)**----->>>>answer is 2

**Example 7:**

### Python code for **DCOUNT **function

Name | Age | Height | Weight |

Olivia | 25 | 210 | 180 |

Noah | 25 | 205 | 235 |

Oliver | 27 | 195 | 205 |

Elijah | 22 | 198 | 185 |

James | 29 | 199 | 231 |

William | 29 | 201 | 240 |

Benjamin | 21 | 202 | 235 |

Lucas | 25 | 200 | 238 |

Henry | 22 | 204 | 190 |

```
import pandas as pd
df=pd.read_csv(‘example.csv’)
dfheight=df[‘Height’]
dfweight=df[‘Weight’]
dfage=df[‘Age’]
dfage=dfage >22
dfheight=dfheight >200
dfweight=dfweight >185
result=dfage *dfheight *dfweight
result=result.sum(axis=0)
print(result)
```

## What is the purpose of **DCOUNT** function?

It counts the cells containing numbers in the field (column) of **records **in the database that match the conditions you specify.

## What is the Return value of **DCOUNT** function?

output of **DCOUNT** function just is number.

**DCOUNT** (database, field, criteria)=number

## How many arguments does **DCOUNT** function have?

**DCOUNT**(database, field, criteria)

**DCOUNT** function has 3 arguments.

- In the
**Database section**you can enter the range of cells that make up the list or database **Field section**is either the label of the column in double quotation marks**Criteria section**is the range of cells that contains the conditions you specify

## Which version of excel supports **DCOUNT** function?

This function is available for all excel **versions **(2003-2019)

## Errors in **DCOUNT** function

If the column title is not a numeric variable, it will give false results

`=DCOUNT(Table3[#All],"Name",A1:D2)`

In this case,we should use DCOUNTA function.

## Conditions and criteria range in **DCOUNT** function

we can define any range for the criteria argument: it has 2 condition

1. It includes at least one column label

2. It includes at least one cell under the column label.

For example, if the range A1:A2 contains “Name” in A1 and “Benjamin” in A2,

you could define A1=”Name” & A2=”Benjamin”

**DCOUNT** function find the word of “Benjamin” under “name” column

### Criteria argument in **DCOUNT** function

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.