DCOUNTA function
Counts the non-empty cells in one column of a list for the records that match the conditions in a criteria range.
Available in All versions of Excel, including Microsoft 365 and Excel for the web
In every Excel versionWorks in Google Sheets
Syntax
DCOUNTA(database, [field], criteria)| Argument | What it means | |
|---|---|---|
database | Required | The list including its header row. |
field | Optional | The column to check for non-empty cells, as a header in quotes or a column number. If omitted, all matching records are counted. |
criteria | Required | The criteria range with headers and conditions. |
Returns: How many matching records have something (number, text, logical value or error) in field.
How DCOUNTA works
DCOUNTA is the "count anything that isn't empty" member of the database functions. It is to DCOUNT what COUNTA is to COUNT: a matching record is counted when the chosen field contains any value — text, a number, TRUE/FALSE, even an error. Only truly empty cells are skipped.
That makes it the natural choice when the field holds text (names, codes, suppliers) or a mix of numbers and notes. A common trick is to count records by pointing the field at a column that is always filled, such as an item name or ID, so the result is simply the number of records that meet the criteria.
Examples
1Cable products with any stock entry
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Item | Category | Stock | Supplier | ||
| 2 | HDMI cable | Cables | 120 | Volt | 3 | |
| 3 | USB-C cable | Cables | n/a | Volt | ||
| 4 | Mouse | Input | 45 | Clicko | ||
| 5 | Keyboard | Input | 0 | Clicko | ||
| 6 | Ethernet cable | Cables | 80 | NetPro | ||
| 7 | Webcam | Video | 15 | Lumo | ||
| 8 | ||||||
| 9 | Category | |||||
| 10 | Cables |
Result: 3
All three cables have something in the Stock column, including the text n/a, so DCOUNTA returns 3. DCOUNT with the same arguments returns 2.
2Count items with at least 40 in stock
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Item | Category | Stock | Supplier | ||
| 2 | HDMI cable | Cables | 120 | Volt | 3 | |
| 3 | USB-C cable | Cables | n/a | Volt | ||
| 4 | Mouse | Input | 45 | Clicko | ||
| 5 | Keyboard | Input | 0 | Clicko | ||
| 6 | Ethernet cable | Cables | 80 | NetPro | ||
| 7 | Webcam | Video | 15 | Lumo | ||
| 8 | ||||||
| 9 | Stock | |||||
| 10 | >=40 |
Result: 3
Counting the Item column (always filled) gives the number of matching records: HDMI cable (120), Mouse (45) and Ethernet cable (80). The n/a text is not compared as a number, so it does not match.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#VALUE! | The field name is not one of the list's headers. | Use the exact header text or the column number. |
Tips
- A cell with a formula returning
""is not empty, so DCOUNTA counts it. - To count unique values among the matches, use UNIQUE with FILTER in Microsoft 365 instead.
Google Sheets
DCOUNTA also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
DCOUNTA in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Czech | DPOČET2 |
| Danish | DTÆLV |
| Dutch | DBAANTALC |
| Finnish | TLASKEA |
| French | BDNBVAL |
| German | DBANZAHL2 |
| Hungarian | AB.DARAB2 |
| Italian | DB.CONTA.VALORI |
| Norwegian (Bokmål) | DANTALLA |
| Polish | BD.ILE.REKORDÓW.A |
| Portuguese (Brazil) | BDCONTARA |
| Portuguese (Portugal) | BDCONTAR.VAL |
| Russian | БСЧЁТА |
| Spanish | BDCONTARA |
| Swedish | DANTALV |
| Turkish | VSEÇSAYDOLU |