Arrow left
Back to guides
Google Sheets Formulas

DCOUNT Function in Google Sheets: Explained

In this article, you will learn how to use the DCOUNT formula in Google Sheets.

What is the DCOUNT function in Google Sheets?

The DCOUNT function in Google Sheets is similar to the COUNTIF or COUNTIFS functions. The DCOUNT computes the number of numeric database entries based on specific criteria. The "D" in DCOUNT stands for database, as the function is commonly used to count records in a database.

To use the DCOUNT formula, you must have a dataset with table headers (column titles), as shown below.

A sample dataset for the DCOUNT function in Google Sheets

When is the DCOUNT formula beneficial in Google Sheets?

The DCOUNT formula in Google Sheets is beneficial when you want to count the number of cells in a range that meet specified criteria.

Specifically, it is useful when working with large datasets that contain multiple columns or rows and you need to filter the data based on particular conditions. Some common scenarios where the DCOUNT formula can be used include:

  • Counting the number of sales transactions for a specific product or customer in a significant sales database.

  • Computing the number of employees with a particular job title or department in a human resources database.

  • Calculating the number of students who scored above a specific grade in a school exam database.

In each case, the DCOUNT formula enables you to quickly and easily filter the data based on specific criteria and obtain an accurate count of the matching records. This can be useful for generating reports, analyzing trends, and making informed decisions based on the data.

Save hours formatting your next financial spreadsheet!
100+ templates, all free to use.
Free Spreadsheet Templates

How to use the DCOUNT function in Google Sheets

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

  • Type “=DCOUNT(“ or navigate to “Insert”“Function” (or directly go to the “Functions” icon) → “Database”“DCOUNT”.

  • Select the entire dataset you want to analyze.

  • Choose the column header whose number of items you want to compute.

  • Input one or more criteria that items should meet.

How to insert the DCOUNT function in Google Sheets

The general syntax of the DCOUNT formula is as follows:

=DCOUNT(database, field, criteria)

database: This argument should be a range or array whose first row contains table headers (or field names), followed by values in rows (from the second row and downwards) for each field. The “database” could be something like the table in the picture below.

field: This parameter should be one of the table headers in “database”. The formula counts the number of values in this column that meet specific condition(s). This argument can be a text string (manual input) of the table header or a column number of the column you want to refer to, assuming the leftmost column in the selected dataset is 1. You can use a cell reference as well.

criteria: This argument should be a range or an array whose first row contains field name(s), followed by specific condition(s) in the second row and downwards.

A sample database for the DCOUNT formula in Google Sheets

Look at the following four examples where we apply the DCOUNT formula to the dataset above. Assume you want to calculate the number of sales transactions that meet one or more conditions we will determine. 

In the first example, imagine you need to calculate the number of sales transactions from Client A. 

  • Select the entire table, including the row showing table headers, for the “database” argument.

  • Enter the “field” by selecting the cell containing the column header whose column values that meet “criteria” are counted.

  • Prepare the “criteria” range as shown in the picture below. Enter a table header in a cell and a condition beneath the cell embedding the table header.

  • The formula should look as follows.
=DCOUNT($B$2:$E$12,$E$2,$B$15:$B$16)

Although we strongly recommend you use cell references in the DCOUNT formula as they make the formula easy to understand and dynamic, if you are interested in using the DCOUNT function with manual inputs for the “field” and “criteria” parameters, you can insert the formula as follow:

=DCOUNT($B$2:$E$12,"Sales Amount ($)",{"Client";"Client A"})

Note that you need to enclose text strings with quotation marks and that you need to enter a table header and a criterion separately, split by a semicolon and surrounded by a pair of curly brackets.

You can replace the table header provided by manual input or cell reference with a column number, 4 in this case, as “Sales Amount” is in the fourth column in the dataset.

=DCOUNT($B$2:$E$12,4,{"Client";"Client A"})

How to use the DCOUNT function with a criterion in Google Sheets

The second example shows the case in which the DCOUNT formula calculates the number of sales transactions with “Client A” or “Client B”. Suppose you exclude changes in cell addresses in the DCOUNT formula.

In that case, the only difference between the first and second examples is that the “criteria” range is expanded by one cell downwards, as you can see in the following picture. When you want to add one or more conditions for the column header used for “criteria”, you enter the additional requirement(s) in the cells right below the first condition.

The formula with cell references looks as follows:

=DCOUNT($B$24:$E$34,$E$24,$B$37:$B$39)

How to use DCOUNT with two sub-conditions for a single column header in Google Sheets

The third example presents how you sum up the number of sales transactions that meet two criteria in two fields.

Imagine you want to compute the number of sales contracted with Client A on 2/4/2023 and afterward. Note that when you add a new table header in the “criteria” parameter, you put it in the cell next to the right of the existing table header for “criteria” and enter a specific condition below the cell containing the additional table header.

The formula with cell references looks as follows:

=DCOUNT($B$44:$E$54,$E$44,$B$57:$C$58)

(The formula with manual inputs)

=DCOUNT($B$44:$E$54,$E$44,{{"Client";"Client A"},{"Contract Date";">=2/4/2023"}})

How to use the DCOUNT formula with two requirements in Google Sheets

The last example shows the DCOUNT function containing three requirements. Assume that you need to count the number of sales that meet three conditions: (i) “Product” is “Type X”, (ii) “Contract Date” is on or before 2/7/2023, and (iii) “Sale Amount ($)” is equal to or greater than 3000.

You can create the formula with cell references as follows:

For the formula with manual inputs, you must (i) enclose each pair of a table header and a specific criterion with curly brackets, (ii) divide each chunk enclosed by the curly brackets by a comma, and (iii) enclose all chunks separated by a comma with a pair of curly brackets.

=DCOUNT($B$64:$E$74,$E$64,{{"Product";"Type X"},{"Contract Date";"<=2/7/2023"},{"Sales Amount ($)";">=3000"}})

How to use the DCOUNT formula with three conditions in Google Sheets

Learn Sheets for financial analysis today!
LiveFlow Academy teaches you the basics for free. Certificates available!
Enroll in LiveFlow Academy

What is the difference between the DCOUNT and COUNT formulas?

The main difference between the DCOUNT and COUNT formulas in Google Sheets is that DCOUNT is a more powerful and flexible formula that allows you to count the number of cells incorporating numeric values based on one or more certain condition(s) in a given array.

In contrast, the COUNT function simply counts the number of cells that contain numbers within a range.

So, you can consider using the COUNT formula when you want to count the number of cells containing numbers. However, if the dataset you need to dig into is large and complicated and if you have specific standards you want to apply when counting the number of cells, it is recommended to use the DCOUNT function instead.

What is the difference between the DCOUNT and DCOUNTA functions?

The main difference between the DCOUNT and DCOUNTA functions in Google Sheets is that DCOUNT counts numeric values, while DCOUNTA counts all non-blank cells, including text and empty cells. 

Turn Quickbooks Online data into a Google Sheets dashboard
100+ templates, update automatically, totally secure!
Book a Demo

Learn how to do this step-by-step in the video below 👇

Automate financial reporting with LiveFlow

Want to eliminate manual updates of your Excel & Google Sheets models?

Yes, show me how

Need help?

Our team is here to help you any time between 9am and 10pm EST.
Check Icon
Email us at: help@liveflow.io

Liked this article? Then you'll love the ones below