DCOUNT in Google Sheets

What is DCOUNT Function in Google Sheets?

The DCOUNT function counts numeric values from a dataset similar to a database table or range using an SQL-like query in Google Sheets. The DCOUNT function in Google Sheets is like the COUNTIF function, the only difference being it is analogous to an SQL database count query as the “D” in DCOUNT stands for database. The DCOUNT counts the database entries based on specific criteria.

To use DCOUNT in Google Sheets, you have to specify the range of cells that contains the data to be analyzed, the name of the column that contains the values and the criteria. For example, to count how many people have scored above 90, let us enter the following formula:

=DCOUNT(A1:C6, 3, E1:E2). Here, the database is A1:C6. The field is 3 as score in the third column, and the cell E1:E2 contains the criteria:

DCOUNT in Google Sheets - Definition
Key Takeaways
  1. The DCOUNT function in Google Sheets is used to count the number of cells within a database range, that satisfy specified criteria.
  2. The syntax of DCOUNT in Google Sheets is as follows:
  3. =DCOUNT(database, field, criteria)
    • database: The range of cells containing data
    • field: The column name or number representing the column to count.
    • criteria: The range that contains the criteria.
  4. DCOUNT can handle relatively large datasets, which is useful in business or financial analysis.
  5. If a cell in the specified column is blank, it will not be counted.

Syntax

The general syntax of the DCOUNT formula is as follows:

=DCOUNT(database, field, criteria)

  1. ‍database: This is a range or array with headers as the first row followed by values in the subsequent rows. The database should be in the form of a table.
  2. field: This is the table header of the database. The formula counts the values in this column meeting a specified criterion. It can be a text string (header name) or a column number of the column we refer to. We can use a cell reference as well.
  3. criteria: This argument should be a range or an array whose first row is the field header name, followed by the required conditions in the second row and downwards.

How to Use DCOUNT Function in Google Sheets?

The DCOUNT function in Google Sheets counts the number of cells that contain numbers in a database or range based on a given condition. There are two ways to enter the DCOUNT function in Google Sheets.

  • Enter DCOUNT manually
  • Through the Google Menu bar

Enter DCOUNT manually

As discussed earlier, let us see how to count specific values in a database table by entering DCOUNT in Google Sheets manually.

You can insert the DCOUNT formula in Google Sheets as follows:

Step 1: Enter the details of the database in the form of the table below. Here, we have some fruits which are stocked in a supermarket. We have headers describing the required number of fruits. Let us try to find those fruits which are stocked above 30 in number. We have also input the criteria after including the header, as shown below.

DCOUNT in Google Sheets - Enter Manually

Step 2: Type “=DCOUNT(.“ Select the entire dataset you want to analyze. Here, it is A1:B9. After a comma, for the second argument, choose the column header whose number of items you want to compute.

DCOUNT in Google Sheets - Enter Manually - Step 2

Step 3: Finally, include the range where you have specified the criteria. Close the parentheses and press Enter.

DCOUNT in Google Sheets - Enter Manually - Step 3

You get the result based on the specific criteria. Hope this gives a better understanding of DCOUNT in Google Sheets and how to use it.

Through the Google menu bar

DCOUNT can be entered through the Google menu bar as follows:

  1. Choose the cell where you want to enter the formula.
  2. Go to the menu bar and click on “Insert” ➝ “Function” ➝ “Database ➝ “DCOUNT.”
Through the Google menu bar

Now, enter the required arguments and press Enter.

Examples

DCOUNT is a part of the database functions and is useful for querying and performing calculations on data that meets certain criteria. Let us look at some interesting examples of how to use DCOUNT.

Example #1 – Count the number of customers with a purchase value greater than a specified amount

In this example, let us count the number of customers who have purchased above $180 at a store. For this, first, organize the data in a structured table. Ensure that the table has headers.

Step 1: Now, let us set up a criteria range to specify the search conditions.

Start the DCOUNT Function with =DCOUNT(.

Specify the data range as the first argument. It should include the headers.

Identify the column to count and the criteria range and enter them as the second and third arguments.

=DCOUNT(A1:B6, 2, D1:D2)

DCOUNT in Google Sheets - Example 1 - Step 1

Step 2: Press Enter to see the result. After pressing Enter, you get the count of the customers who have purchased over $180.

DCOUNT in Google Sheets - Example 1 - Step 2

Example #2 – DCOUNT with multiple criteria

Look at the following example where we apply the DCOUNT formula to a given dataset. Assume you want to calculate the number of students who secured more than 80 in Maths and Science. Here. We must specify more than one condition. Let us determine how to use DCOUNT in Google Sheets multiple criteria.

Step 1: Enter the details in a dataset as shown below.

Step 2: Now, you can enter the DCOUNT formula in an empty cell to determine the count of students who secured more than 80 in Maths and Science. Here are the details for your understanding.

  1. Database: A1:C12
  2. Field: 2 (Maths marks)
  3. Criteria: A criteria range that specifies the given two conditions — one for Score in Math and one for Score in Science.

Set the criteria in a separate range, as shown below.

Score in Math  Score in Science
8080
DCOUNT in Google Sheets - Example 2 - Step 2

Step 3: Apply the DCOUNT function:

=DCOUNT(A1:C12, 2, E1:F2). Press Enter.

DCOUNT in Google Sheets - Example 2 - Step 3

You get a count of the students who scored more than 80 in both subjects.

Example #3

Given below are some employee details. Suppose we must count the number of employees who are Engineers and have a salary greater than 60000.

Step 1: Enter the details in a sheet.  Enter the required criteria: a salary greater than 60000 and a job designation as “Engineer.” Count the number of rows that meet this specified criterion with DCOUNT.

DCOUNT in Google Sheets - Example 3 - Step 1

Step 2: Enter the following function in an empty cell.

=DCOUNT(A1:C8, 3, E1:F2). Here,

  1. Database: A1:C8
  2. Field: 3 (Salary)
  3. Criteria: A criteria range that specifies the given two conditions — one for Designation and one for Salary.
DCOUNT in Google Sheets - Example 3 - Step 2

Step 3: Press Enter. The formula will count how many rows meet both conditions.

DCOUNT in Google Sheets - Example 3 - Step 3

Important Things to Note

  1. Use a criteria range to specify the multiple conditions.
  2. Placing multiple conditions in a single row of the criteria range works as an AND condition.
  3. You can use DCOUNT with the FILTER function for advanced counting
  4. DCOUNT will only count cells containing numbers, while text and empty cells are ignored.

Frequently Asked Questions (FAQs)

What are the differences between DCOUNT and COUNTIF?

COUNTIF is a simple function used for counting based on a condition, while DCOUNT is designed to handle more complex database-like scenarios with more structured data and multiple criteria.
COUNTIFS is another function that can count based on multiple criteria across various columns, but it does not work on a database structure and with a field selection like DCOUNT.

How to count rows with specific criteria using DCOUNT?

To count rows with specific criteria,  we must create a criteria range to specify all the given conditions. For instance, if you want to count rows with the conditions that salary is greater than 50000 and age greater than 30, you can specify them in a separate range and use it in the formula as the third argument.

What are the uses of the DCOUNT formula in Google Sheets?

The DCOUNT formula in Google Sheets is especially useful when working with large datasets containing multiple columns or rows. You can use DCOUNT to filter the data based on specific criteria. Some scenarios where this could be useful include:
1. Calculating the number of students who performed above a specific grade in an exam.
2. When counting the number of sales for a specific product.
3. When computing the number of employees receiving a particular pay in an organization and much more.

Download Template

This article must help understand DCOUNT in Google Sheets with its formulas and examples. You can download the template here to use it instantly.

Recommended Articles

Guide to What Is DCOUNT in Google Sheets. We learn its syntax & how to use it to count values in a dataset with detailed examples. You can learn more from the following articles. –

Convert Function in Google Sheets

YIELD in Google Sheets

SWITCH Google Sheets Function

Reader Interactions

Leave a Reply

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

CHATGPT & AI FOR MICROSOFT EXCEL COURSE - Today Only: 60% + 20% OFF! 🚀

X