DCOUNTA function in Excel

What is DCOUNTA Function in Excel?


The DCOUNTA function is one of the Database functions of Excel.

It counts nonblank cells 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 DCOUNTA function in excel

  1. Click on an empty cell (like F5 )
Click on an empty cell

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

Click on the fx icon

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

insert function tab

4. Select Database category

5. Select DCOUNTA function

6. Then select ok

7. In the function arguments Tab you will see DCOUNTA 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

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

How to use DCOUNTA function in excel

Examples of DCOUNTA function in excel

Example1:

Calculate the number of student Name=”Noah” with DCOUNTA function in excel

 Calculate the number of student Name="Noah" with  DCOUNTA function in excel
=DCOUNTA(Table5[#All],"Name",A1:D2)----->>>>answer is  2
OR we can remove Field section
=DCOUNTA(Table5[#All],,A1:D2)----->>>>answer is  2

Example2:

Calculate the number of student age>25 with DCOUNTA function in excel

 calculate the number of student age>25 with  DCOUNTA function in excel
=DCOUNTA(Table5[#All],"Age",A1:D2)----->>>>answer is  3
OR we can remove Field section
=DCOUNTA(Table5[#All],,A1:D2)----->>>>answer is  3

Example3:

Calculate the number of Names include “m” with DCOUNTA function in excel

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

=DCOUNTA(Table5[#All],"Name",A1:D2)----->>>>answer is  2
OR we can remove Field section
=DCOUNTA(Table5[#All],,A1:D2)----->>>>answer is  2

Example4:

Calculate the number of Names begins with “L” by DCOUNTA function in excel

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

=DCOUNTA(Table5[#All],"Name",A1:D2)----->>>>answer is  1
OR we can remove Field section
=DCOUNTA(Table5[#All],,A1:D2)----->>>>answer is  1

Example 5:

Calculate the number of Row that is not blank by DCOUNTA function in excel

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

 Calculate the number of Row that is not blank  by  DCOUNTA function in excel
=DCOUNTA(Table5[#All],"Name",A1:D2)----->>>>answer is  9
OR we can remove Field section
=DCOUNTA(Table5[#All],,A1:D2)----->>>>answer is  9

Example 6:

Calculate the number of persons that “age>27” and “Weight<235” by DCOUNTA function in excel

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

=DCOUNTA (Table3[#All],"Name",A1:D2)----->>>>answer is  1
OR we can remove Field section
=DCOUNTA (Table3[#All],,A1:D2)----->>>>answer is  1

Example 7:

How to convert number to text in DCOUNT function?

when we want use words as text and filter our search, we can use =”= entry  sign.

Example 8:

How To find rows that meet multiple criteria for one column in DCOUNT function?

We can type the criteria directly below each other in separate rows of the criteria range.

Example 9:

Python code for DCOUNTA function

NameAgeHeightWeight
Olivia25210180
Noah25205235
Oliver27195205
Elijah22198185
James29199231
William29201240
Benjamin21202235
Lucas25200238
Henry22204190
import pandas as pd

df=pd.read_csv(‘example.csv’)

dfheight=df[‘Height’]>200

dfweight=df[‘Weight’]>185

dfage=df[‘Age’]>22

dfname=df[‘Name’] != 0

result=dfage *dfheight *dfweight *dfname

result=result.sum(axis=0)

print(result)

What is the purpose of DCOUNTA function?

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

What is the Return value  of DCOUNTA function?

It returns just number.

DCOUNTA (database, field, criteria)=number,text,....

How many arguments does DCOUNTA function have?

DCOUNTA(database, field, criteria)

DCOUNTA 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 DCOUNTA function?

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

Errors in DCOUNTA function

If no record matches the criteria, DCOUNTA returns 0 value.

Conditions and criteria range in DCOUNTA function

Criteria argument in DGET 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”

DCOUNTA function find the word of “Benjamin” under “name” column

location of Criteria range in DCOUNTA 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.

DCOUNTA related functions :

Leave a Reply

Your email address will not be published. Required fields are marked *