DCOUNTA Function in Google Sheets: Explained
In this article, you will learn how to use the DCOUNTA formula in Google Sheets.
What does the DCOUNTA function do in Google Sheets?
The DCOUNTA formula is similar to the COUNTA formula in terms of its primary feature, counting the number of non-blank cells. The DCOUNTA is similar to the COUNTIF or COUNTIFS functions concerning the capability of applying conditions to the count.
In summary, the DCOUNTA function counts the number of non-empty cells under a specific condition(s). The "D" in DCOUNTA stands for database, as the function is commonly used to count records in a database. To use the DCOUNTA formula, you must have a dataset with table headers (column titles), as shown below.
When should you use the DCOUNTA function in Google Sheets?
You should use the DCOUNTA function in Google Sheets when you want to count the number of non-blank cells in a particular database column that meet specific criteria from a large volume of data. Here are some common use cases for the DCOUNTA function:
- Counting the number of orders for a particular product in a sales database
- Calculating the number of customers who live in a particular state in a customer list
- Computing the number of employees with a specific job title in an employee database
- Confirming the number of invoices with overdue payments in an accounts receivable dataset
How to use the DCOUNTA function in Google Sheets
You can insert the DCOUNTA formula in Google Sheets as follows:
- Type “=DCOUNTA(“ or navigate to “Insert” → “Function” (or directly go to the “Functions” icon) → “Database” → “DCOUNTA”.
- Select the entire dataset you want to analyze.
- Choose the field title (or column header) whose number of items you want to count.
- Input one or more criteria that items should meet.
The general syntax of the DCOUNTA formula is as follows:
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 column headers in “database”. The formula counts the number of non-blank cells 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.
Look at the following cases where we apply the DCOUNTA formula to the sample transaction list above. Assume you want to count the number of sales transactions that meet one or more conditions we will define.
In the first example, imagine you need to compute the number of valid sales transactions from Client A in the list.
- 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.
Although we highly recommend you use cell references in the DCOUNTA formula as they make the formula easy to understand and dynamic, if you are interested in using the DCOUNTA function with manual inputs for the “field” and “criteria” parameters, you can insert the formula as follow:
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.
With these formulas, you can get the returned value of 2. Although highlighted rows meet the criterion we apply, the cells E3 and E6 are not counted by the DCOUNTA because they are empty. Only cells E9 and E12, which embed values, are considered valid by the formula.
The second example shows how the DCOUNTA formula calculates the number of sales transactions with “Client A” or “Client B”. Suppose you exclude changes in cell addresses in the DCOUNTA formula.
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:
Again, cells E25 and 28 are excluded from the result of 5 because they are empty.
The third example presents how you count 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:
(The formula with manual inputs)
In this case, only two cells satisfy the conditions, but one of them (cell E45) is excluded from the result due to the lack of value.
The last example shows the DCOUNTA 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.
The formula returns 1 because only one cell meets the standard and is not blank.
What is the difference between the DCOUNTA and COUNTA formulas?
The main difference between the DCOUNTA and COUNTA formulas in Google Sheets is that the DCOUNTA function counts the number of non-blank cells in a particular column of a database that meet specific criteria, while COUNTA counts the number of non-empty cells in a specified range without any conditions.
To use the DCOUNTA, you need to prepare a range of cells that includes a header row and data rows. DCOUNTA is useful when you want to perform calculations on specific data within a well-organized database.
On the other hand, COUNTA is a regular function that counts the number of non-empty cells in a specified range. You can decide which formula you use depending on the value and complexity of your dataset.
What is the difference between the DCOUNTA and DCOUNT functions?
The main difference between the DCOUNTA and DCOUNT functions in Google Sheets is that DCOUNTA counts the number of non-blank cells, while DCOUNT counts the number of cells embedding numeric values.