What is the DCOUNTA function?
=DCOUNTA(database, field, criteria)DCOUNTA picks only the records in a list (database) that meet a criteria table and counts those whose field (column) is not empty. Its conditions are written as a separate table on the sheet.
F1:G3 is the criteria table: F2 holds "Seoul", F3 holds "Busan" and G2 holds ">=40000". Drag the criteria range to F1:F2 (Seoul), F1:F3 (Seoul or Busan) or F1:G2 (Seoul with sales of 40000 or more).
DCOUNTA counts the records that meet the criteria. DCOUNT counts only numbers, so for a text column such as product or salesperson use DCOUNTA. If you leave the field out, it counts the matching records themselves.
Arguments
- database
- The whole list. The first row must hold the headers.
- field
- The column to calculate: a column number (the first column is 1), a header name such as "Sales", or a cell holding the header (D1).
- criteria
- The criteria table. Its first row uses the same headers as the database, with the conditions below.
DCOUNTA examples
Example 1. Basic use
=DCOUNTA(A1:D9, 2, F1:F2)All 3 Seoul records have a product, so 3.
Example 2. Changing the criteria
=DCOUNTA(A1:D9, 1, F1:F3)The number of Seoul or Busan records: 6.
Example 3. DCOUNTA versus DCOUNT
=DCOUNTA(A1:D9, "Product", F1:F2)On a text column DCOUNT returns 0.
Formula Result Why =DCOUNTA(A1:D9, "Product", F1:F2) 3 All three Seoul records have a product =DCOUNT(A1:D9, "Product", F1:F2) 0 Product names are not numbers =DCOUNTA(A1:D9, "Sales", G1:G2) 4 Records with sales of 40000 or more
Common mistakes
Leaving the header out of the criteria range
The first row of the criteria range must be a header. If you select F2:F3, "Seoul" is read as the header and you get the wrong result.
Mixing up AND and OR
Conditions on the same row must all be met (AND); conditions on different rows only need one to be met (OR).
Fields with blanks
Records where the chosen column is blank are not counted. Pick a column that is always filled, or leave the field out.
FAQ
- How is it different from SUMIFS?
- You can get the same results, but database functions keep the conditions in a table on the sheet, which makes OR conditions and changing conditions easy.
- Can I give the field as a name?
- Yes. Use a header name in double quotes, such as "Sales", or a cell that holds the header.