← All functions

DCOUNTA

Quirk found

Category: Database · Last tested 2026-09-01

Real compatibility results for the DCOUNTA function: executed in Excel for the web, Google Sheets and LibreOffice Calc, with desktop Excel behavior from Microsoft’s official documentation (we do not run desktop Excel — Excel for the web is a different application and is executed separately). Syntax and links to that documentation are below.

Support matrix

EngineDocumentedLive-testedVerdict
Excel (desktop)Yes No — documented only n/a
Excel for the web— Yes (recalc, 2026-09-01) Supported, behaves as documented
Google SheetsYes Yes (Drive import, 2026-08-31) Quirk found
LibreOffice CalcYes Yes (25.8.7.3, 2026-08-31) Supported, behaves as documented

LibreOffice version history

We executed the same test cases under each LibreOffice release to show exactly when DCOUNTA’s support changed — not documentation claims, real results.

LibreOffice versionVerdictTested
24.2.0.3 Supported, behaves as documented 2026-08-31
24.8.7.2 Supported, behaves as documented 2026-08-31
25.2.0.3 Supported, behaves as documented 2026-08-31
25.8.7.3 Supported, behaves as documented 2026-08-31

Why isn’t DCOUNTA working in Google Sheets?

DCOUNTA runs in Google Sheets, but our executed cases show it does not match Excel’s documented behavior on every input (the failing cases are listed on this page). If a formula that behaves one way in Excel gives you a different answer in Sheets, compare your usage against those cases before assuming your data is wrong.

Discovered quirks

Executed test cases

Excel for the web (executed 2026-09-01 via OneDrive recalculation)

These values come from Excel for the web, not from desktop Excel. They are two different implementations of the calculation engine, and this run measured only the web one: the corpus was uploaded to OneDrive as .xlsx, recalculated by Excel for the web on open, and downloaded again for readback. Excel for the web is a rolling service with no pinnable version, so the run is identified by its date. Where a value here disagrees with the Expected column — which is Microsoft’s documentation of the desktop product — we cannot tell you whether the web engine diverges from the desktop one or the documentation is wrong about both, because we do not run desktop Excel.

FormulaDescriptionResultExpectedVerdict
=DCOUNTA(A6:E12,"Profit",A3:F4) Microsoft's documented worked example: non-blank Profit cells among the apple trees between 10 and 16 feet tall 1 1
Provenance

Microsoft publishes this example as '=DCOUNTA(A6:E12, "Profit", A3:F4)' with the result 1 and the explanation "Counts the rows (1) containing 'Apple' in column A with a height >10 and <16. Only row 8 satisfies these three conditions." Criteria A3:F4 is the header row plus the single condition row (Apple, Height >10, Height <16), which selects only the Apple/14ft record; its Profit cell is non-blank, so the count is 1. Set up from Microsoft's own worked example for the database functions: the orchard table, which is one criteria header row, two criteria rows, a database header row and six records. HARNESS PLACEMENT: the page pastes the table at A1, but this harness writes the formula under test into cell F1, which the table's second "Height" criteria header would occupy, so the whole block is pasted two rows lower instead. Every relative offset the page describes is preserved -- the database header is still the row immediately below the last criteria row -- which puts the criteria at A3:F5 and the database at A6:E12 here. One further deviation: the page writes its tree criteria as the cell entry ="=Apple" (the documented trick for storing the literal text =Apple, which forces an exact match). openpyxl cannot author that cell -- any string beginning with = is serialized as a formula -- so the criteria cells here hold the plain text Apple and Pear. On this data the two forms select the same records, because no other tree name in the table begins with "Apple" or "Pear".

Matched
=DCOUNTA(A6:E12,,A3:F4) The optional field argument omitted, so every matching record is counted 1 1
Provenance

Microsoft documents: "The field argument is optional. If field is omitted, DCOUNTA counts all records in the database that match the criteria." The same criteria as the documented example match exactly one record, so the count is 1 with or without the field. This case exists because an engine that treats the middle argument as required fails here while passing the documented example. Set up from Microsoft's own worked example for the database functions: the orchard table, which is one criteria header row, two criteria rows, a database header row and six records. HARNESS PLACEMENT: the page pastes the table at A1, but this harness writes the formula under test into cell F1, which the table's second "Height" criteria header would occupy, so the whole block is pasted two rows lower instead. Every relative offset the page describes is preserved -- the database header is still the row immediately below the last criteria row -- which puts the criteria at A3:F5 and the database at A6:E12 here. One further deviation: the page writes its tree criteria as the cell entry ="=Apple" (the documented trick for storing the literal text =Apple, which forces an exact match). openpyxl cannot author that cell -- any string beginning with = is serialized as a formula -- so the criteria cells here hold the plain text Apple and Pear. On this data the two forms select the same records, because no other tree name in the table begins with "Apple" or "Pear".

Matched
=DCOUNTA(A6:E12,"Tree",A3:A5) Counting non-blank cells in a TEXT field, which is what separates DCOUNTA from DCOUNT 5 5
Provenance

Derived from the documented description, "Counts the nonblank cells in a field (column) of records" -- unlike DCOUNT, which the sibling page defines as counting cells "that contain numbers". Criteria A3:A5 is the Tree column header plus the two tree names, so it selects the five apple and pear records (yields 14, 10, 10, 8 and 6) and excludes the single cherry. All five have a non-blank Tree cell, so DCOUNTA returns 5 where DCOUNT on the same field would return 0. Set up from Microsoft's own worked example for the database functions: the orchard table, which is one criteria header row, two criteria rows, a database header row and six records. HARNESS PLACEMENT: the page pastes the table at A1, but this harness writes the formula under test into cell F1, which the table's second "Height" criteria header would occupy, so the whole block is pasted two rows lower instead. Every relative offset the page describes is preserved -- the database header is still the row immediately below the last criteria row -- which puts the criteria at A3:F5 and the database at A6:E12 here. One further deviation: the page writes its tree criteria as the cell entry ="=Apple" (the documented trick for storing the literal text =Apple, which forces an exact match). openpyxl cannot author that cell -- any string beginning with = is serialized as a formula -- so the criteria cells here hold the plain text Apple and Pear. On this data the two forms select the same records, because no other tree name in the table begins with "Apple" or "Pear".

Matched
=DCOUNTA(A6:E12,4,A3:A5) The field named by its 1-based column position instead of its label 5 5
Provenance

Microsoft documents the field argument as accepting "a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on". Column 4 of A6:E12 is Yield. Criteria A3:A5 is the Tree column header plus the two tree names, so it selects the five apple and pear records (yields 14, 10, 10, 8 and 6) and excludes the single cherry. Each has a non-blank Yield, so the count is 5 -- the same answer as the label form, which is the point of the case. Set up from Microsoft's own worked example for the database functions: the orchard table, which is one criteria header row, two criteria rows, a database header row and six records. HARNESS PLACEMENT: the page pastes the table at A1, but this harness writes the formula under test into cell F1, which the table's second "Height" criteria header would occupy, so the whole block is pasted two rows lower instead. Every relative offset the page describes is preserved -- the database header is still the row immediately below the last criteria row -- which puts the criteria at A3:F5 and the database at A6:E12 here. One further deviation: the page writes its tree criteria as the cell entry ="=Apple" (the documented trick for storing the literal text =Apple, which forces an exact match). openpyxl cannot author that cell -- any string beginning with = is serialized as a formula -- so the criteria cells here hold the plain text Apple and Pear. On this data the two forms select the same records, because no other tree name in the table begins with "Apple" or "Pear".

Matched

Google Sheets (executed 2026-08-31 via Drive import)

Google Sheets is a rolling service with no pinnable version, so this run is identified by its date. The corpus was imported to Drive as .xlsx, recalculated by Sheets, and exported back for readback.

FormulaDescriptionResultExpectedVerdict
=DCOUNTA(A6:E12,"Profit",A3:F4) Microsoft's documented worked example: non-blank Profit cells among the apple trees between 10 and 16 feet tall 1 1
Provenance

Microsoft publishes this example as '=DCOUNTA(A6:E12, "Profit", A3:F4)' with the result 1 and the explanation "Counts the rows (1) containing 'Apple' in column A with a height >10 and <16. Only row 8 satisfies these three conditions." Criteria A3:F4 is the header row plus the single condition row (Apple, Height >10, Height <16), which selects only the Apple/14ft record; its Profit cell is non-blank, so the count is 1. Set up from Microsoft's own worked example for the database functions: the orchard table, which is one criteria header row, two criteria rows, a database header row and six records. HARNESS PLACEMENT: the page pastes the table at A1, but this harness writes the formula under test into cell F1, which the table's second "Height" criteria header would occupy, so the whole block is pasted two rows lower instead. Every relative offset the page describes is preserved -- the database header is still the row immediately below the last criteria row -- which puts the criteria at A3:F5 and the database at A6:E12 here. One further deviation: the page writes its tree criteria as the cell entry ="=Apple" (the documented trick for storing the literal text =Apple, which forces an exact match). openpyxl cannot author that cell -- any string beginning with = is serialized as a formula -- so the criteria cells here hold the plain text Apple and Pear. On this data the two forms select the same records, because no other tree name in the table begins with "Apple" or "Pear".

Matched
=DCOUNTA(A6:E12,,A3:F4) The optional field argument omitted, so every matching record is counted #VALUE! 1
Provenance

Microsoft documents: "The field argument is optional. If field is omitted, DCOUNTA counts all records in the database that match the criteria." The same criteria as the documented example match exactly one record, so the count is 1 with or without the field. This case exists because an engine that treats the middle argument as required fails here while passing the documented example. Set up from Microsoft's own worked example for the database functions: the orchard table, which is one criteria header row, two criteria rows, a database header row and six records. HARNESS PLACEMENT: the page pastes the table at A1, but this harness writes the formula under test into cell F1, which the table's second "Height" criteria header would occupy, so the whole block is pasted two rows lower instead. Every relative offset the page describes is preserved -- the database header is still the row immediately below the last criteria row -- which puts the criteria at A3:F5 and the database at A6:E12 here. One further deviation: the page writes its tree criteria as the cell entry ="=Apple" (the documented trick for storing the literal text =Apple, which forces an exact match). openpyxl cannot author that cell -- any string beginning with = is serialized as a formula -- so the criteria cells here hold the plain text Apple and Pear. On this data the two forms select the same records, because no other tree name in the table begins with "Apple" or "Pear".

Mismatch
=DCOUNTA(A6:E12,"Tree",A3:A5) Counting non-blank cells in a TEXT field, which is what separates DCOUNTA from DCOUNT 5 5
Provenance

Derived from the documented description, "Counts the nonblank cells in a field (column) of records" -- unlike DCOUNT, which the sibling page defines as counting cells "that contain numbers". Criteria A3:A5 is the Tree column header plus the two tree names, so it selects the five apple and pear records (yields 14, 10, 10, 8 and 6) and excludes the single cherry. All five have a non-blank Tree cell, so DCOUNTA returns 5 where DCOUNT on the same field would return 0. Set up from Microsoft's own worked example for the database functions: the orchard table, which is one criteria header row, two criteria rows, a database header row and six records. HARNESS PLACEMENT: the page pastes the table at A1, but this harness writes the formula under test into cell F1, which the table's second "Height" criteria header would occupy, so the whole block is pasted two rows lower instead. Every relative offset the page describes is preserved -- the database header is still the row immediately below the last criteria row -- which puts the criteria at A3:F5 and the database at A6:E12 here. One further deviation: the page writes its tree criteria as the cell entry ="=Apple" (the documented trick for storing the literal text =Apple, which forces an exact match). openpyxl cannot author that cell -- any string beginning with = is serialized as a formula -- so the criteria cells here hold the plain text Apple and Pear. On this data the two forms select the same records, because no other tree name in the table begins with "Apple" or "Pear".

Matched
=DCOUNTA(A6:E12,4,A3:A5) The field named by its 1-based column position instead of its label 5 5
Provenance

Microsoft documents the field argument as accepting "a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on". Column 4 of A6:E12 is Yield. Criteria A3:A5 is the Tree column header plus the two tree names, so it selects the five apple and pear records (yields 14, 10, 10, 8 and 6) and excludes the single cherry. Each has a non-blank Yield, so the count is 5 -- the same answer as the label form, which is the point of the case. Set up from Microsoft's own worked example for the database functions: the orchard table, which is one criteria header row, two criteria rows, a database header row and six records. HARNESS PLACEMENT: the page pastes the table at A1, but this harness writes the formula under test into cell F1, which the table's second "Height" criteria header would occupy, so the whole block is pasted two rows lower instead. Every relative offset the page describes is preserved -- the database header is still the row immediately below the last criteria row -- which puts the criteria at A3:F5 and the database at A6:E12 here. One further deviation: the page writes its tree criteria as the cell entry ="=Apple" (the documented trick for storing the literal text =Apple, which forces an exact match). openpyxl cannot author that cell -- any string beginning with = is serialized as a formula -- so the criteria cells here hold the plain text Apple and Pear. On this data the two forms select the same records, because no other tree name in the table begins with "Apple" or "Pear".

Matched

LibreOffice Calc 25.8.7.3 (tested 2026-08-31)

FormulaDescriptionResultExpectedVerdict
=DCOUNTA(A6:E12,"Profit",A3:F4) Microsoft's documented worked example: non-blank Profit cells among the apple trees between 10 and 16 feet tall 1 1
Provenance

Microsoft publishes this example as '=DCOUNTA(A6:E12, "Profit", A3:F4)' with the result 1 and the explanation "Counts the rows (1) containing 'Apple' in column A with a height >10 and <16. Only row 8 satisfies these three conditions." Criteria A3:F4 is the header row plus the single condition row (Apple, Height >10, Height <16), which selects only the Apple/14ft record; its Profit cell is non-blank, so the count is 1. Set up from Microsoft's own worked example for the database functions: the orchard table, which is one criteria header row, two criteria rows, a database header row and six records. HARNESS PLACEMENT: the page pastes the table at A1, but this harness writes the formula under test into cell F1, which the table's second "Height" criteria header would occupy, so the whole block is pasted two rows lower instead. Every relative offset the page describes is preserved -- the database header is still the row immediately below the last criteria row -- which puts the criteria at A3:F5 and the database at A6:E12 here. One further deviation: the page writes its tree criteria as the cell entry ="=Apple" (the documented trick for storing the literal text =Apple, which forces an exact match). openpyxl cannot author that cell -- any string beginning with = is serialized as a formula -- so the criteria cells here hold the plain text Apple and Pear. On this data the two forms select the same records, because no other tree name in the table begins with "Apple" or "Pear".

Matched
=DCOUNTA(A6:E12,,A3:F4) The optional field argument omitted, so every matching record is counted 1 1
Provenance

Microsoft documents: "The field argument is optional. If field is omitted, DCOUNTA counts all records in the database that match the criteria." The same criteria as the documented example match exactly one record, so the count is 1 with or without the field. This case exists because an engine that treats the middle argument as required fails here while passing the documented example. Set up from Microsoft's own worked example for the database functions: the orchard table, which is one criteria header row, two criteria rows, a database header row and six records. HARNESS PLACEMENT: the page pastes the table at A1, but this harness writes the formula under test into cell F1, which the table's second "Height" criteria header would occupy, so the whole block is pasted two rows lower instead. Every relative offset the page describes is preserved -- the database header is still the row immediately below the last criteria row -- which puts the criteria at A3:F5 and the database at A6:E12 here. One further deviation: the page writes its tree criteria as the cell entry ="=Apple" (the documented trick for storing the literal text =Apple, which forces an exact match). openpyxl cannot author that cell -- any string beginning with = is serialized as a formula -- so the criteria cells here hold the plain text Apple and Pear. On this data the two forms select the same records, because no other tree name in the table begins with "Apple" or "Pear".

Matched
=DCOUNTA(A6:E12,"Tree",A3:A5) Counting non-blank cells in a TEXT field, which is what separates DCOUNTA from DCOUNT 5 5
Provenance

Derived from the documented description, "Counts the nonblank cells in a field (column) of records" -- unlike DCOUNT, which the sibling page defines as counting cells "that contain numbers". Criteria A3:A5 is the Tree column header plus the two tree names, so it selects the five apple and pear records (yields 14, 10, 10, 8 and 6) and excludes the single cherry. All five have a non-blank Tree cell, so DCOUNTA returns 5 where DCOUNT on the same field would return 0. Set up from Microsoft's own worked example for the database functions: the orchard table, which is one criteria header row, two criteria rows, a database header row and six records. HARNESS PLACEMENT: the page pastes the table at A1, but this harness writes the formula under test into cell F1, which the table's second "Height" criteria header would occupy, so the whole block is pasted two rows lower instead. Every relative offset the page describes is preserved -- the database header is still the row immediately below the last criteria row -- which puts the criteria at A3:F5 and the database at A6:E12 here. One further deviation: the page writes its tree criteria as the cell entry ="=Apple" (the documented trick for storing the literal text =Apple, which forces an exact match). openpyxl cannot author that cell -- any string beginning with = is serialized as a formula -- so the criteria cells here hold the plain text Apple and Pear. On this data the two forms select the same records, because no other tree name in the table begins with "Apple" or "Pear".

Matched
=DCOUNTA(A6:E12,4,A3:A5) The field named by its 1-based column position instead of its label 5 5
Provenance

Microsoft documents the field argument as accepting "a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on". Column 4 of A6:E12 is Yield. Criteria A3:A5 is the Tree column header plus the two tree names, so it selects the five apple and pear records (yields 14, 10, 10, 8 and 6) and excludes the single cherry. Each has a non-blank Yield, so the count is 5 -- the same answer as the label form, which is the point of the case. Set up from Microsoft's own worked example for the database functions: the orchard table, which is one criteria header row, two criteria rows, a database header row and six records. HARNESS PLACEMENT: the page pastes the table at A1, but this harness writes the formula under test into cell F1, which the table's second "Height" criteria header would occupy, so the whole block is pasted two rows lower instead. Every relative offset the page describes is preserved -- the database header is still the row immediately below the last criteria row -- which puts the criteria at A3:F5 and the database at A6:E12 here. One further deviation: the page writes its tree criteria as the cell entry ="=Apple" (the documented trick for storing the literal text =Apple, which forces an exact match). openpyxl cannot author that cell -- any string beginning with = is serialized as a formula -- so the criteria cells here hold the plain text Apple and Pear. On this data the two forms select the same records, because no other tree name in the table begins with "Apple" or "Pear".

Matched

Docs & syntax