COUNTBLANK(range) counts the cells in a range that are blank, where blank has a specific
documented meaning that is not the same as "empty".
Microsoft's page states the rule in two sentences: cells with formulas that return "" (empty
text) are also counted, and cells with zero values are not counted. So:
Cell content
Counted as blank?
Nothing at all
yes
A formula returning ""
yes
A literal empty string
yes, on the same rule
0
no
Any other number, text, or logical
no
An error value
not documented — see below
The definition is therefore display-shaped rather than content-shaped: a cell counts as blank if
it shows nothing, even when it contains a formula. That is a defensible choice for the job the
function exists to do — finding gaps in a data-entry region — and it is the reason COUNTBLANK is
not the complement of COUNTA.
The arithmetic that surprises people.COUNTA counts a "" cell (it contains information) and
COUNTBLANK counts the same cell (it displays nothing). So for a range r,
COUNTA(r) + COUNTBLANK(r) ≥ ROWS(r) * COLUMNS(r)
with equality only when no cell holds empty text. Two functions, two definitions of blank, both
documented, both correct on their own terms. Anyone reconciling a count should decide which
definition they mean before choosing a function.
Arguments
COUNTBLANK(range) — one argument.
Argument
Meaning (as documented)
range
"The range from which you want to count the blank cells"
Microsoft's page states plainly that the function accepts one argument. The argument is a range,
not a value: this is a reference-sensitive surface, and the distinction is load-bearing rather than
stylistic — see the next section.
Try it
Quirks
The signature divergence
Excel accepts several ranges undocumented, and the documentation is narrow.
Excel accepts several arguments but the documentation describes the supported usage.
=COUNTBLANK(A1:A3, C1:C3) in a live Excel decides it in one cell. It is the first probe listed
below, and it is the kind of question this Handbook exists to publish rather than guess at.
Result and edge cases
Returns Number — a non-negative integer count.
Zero is not blank. Documented. This is the rule that makes COUNTBLANK usable on numeric
columns where 0 is a real observation.
Never-touched cells inside the range count. They have no value at all, which is the
uncontroversial half of the definition.
Errors
The documentation states no error conditions for this function.
Error
Condition
#VALUE!
An array-valued argument is supplied instead of a range
propagated
An error value in a scanned cell surfaces as the function's result
#VALUE!
Argument-count or preparation failure
The array-rejection row has the live-Excel anchor described above. The error-propagation row has no
anchor at all.
COUNTBLANK of an omitted optional LAMBDA parameter is #VALUE!
An optional LAMBDA parameter left out reaches COUNTBLANK as a missing value, and the result is #VALUE!, not a count of 1.
Explanation (inferred): That this holds for missing values in general is inferred.
Formula
Excel
Mathematical value
=LAMBDA([xx],COUNTBLANK(xx))() Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZAInputs and reference value
Take the reference, not the values. Resolving to values first destroys the information the
function needs: you cannot count cells that never existed as values. This is why the surface is
declared reference-visible at the adapter.
Reject arrays deliberately. It is tempting to reuse the aggregate expansion helper that
serves COUNT and COUNTA; that is precisely the mistake the upstream bug stream records, and
the root-cause note calls it inheriting an over-permissive shape rather than a regression.
Empty text is a Text value. The predicate is "is this Text of zero length", not "does this
render as nothing". A number formatted to display nothing is not blank.
Rust code
Show the CalcFunc source of this function
Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.
/// COUNTBLANK: the cells of its reference, a single area, that are blank or hold empty text: the/// area's size less the cells the reader visits with any other value, so the cost follows the/// reader's visits and not the area's size, and a blank cell the reader visits as Empty counts/// as blank. A reader that visits more such cells than the area holds breaks its contract and/// cannot supply the area. A reference of several areas is #VALUE! (dc-bd5: COUNTBLANK((A5,A6)))./// A computed scalar is #VALUE!; calc-fml lifts computed arrays over this scalar rule (W111/// count-family and w089-axis-reference-vs-array-variant readings in OxFunc-Evidence).fncountblank(
arguments: &[CalcValue],
services: &mutEvalServices<'_>,
) -> Result<CalcValue, FunctionFault> {
let site = Site::new(COUNTBLANK, services);
Site::finish(blanks(&site, &arguments[0], services))
}
No implementation has been published with a Handbook test suite for this function.
Version differences
No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.
Excel 16.0.20527.20088
Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
=LAMBDA([xx],COUNTBLANK(xx))() returned #VALUE!. Inputs were supplied through formula literals. These are controls from this environment, not a same-input comparison with another build.
COUNTA — the near-complement that is not a complement, because both count
empty-text cells. The pair is the clearest illustration in Excel that "blank" is not one concept.
COUNT — counts numbers only; 0 counts there and does not count here, which
is the one place all three functions agree in spirit.
COUNTIF — COUNTIF(range,"") and COUNTIF(range,"<>") are the usual
attempted substitutes. They run the criteria matcher's own blank-and-empty-text rules, which are
a third definition again, so they are not reliable stand-ins. If you need a specific definition of
blank, write it explicitly with ISBLANK or LEN.
ISBLANK — the per-cell predicate, and a fourth definition: ISBLANK is
false for a formula returning "", where COUNTBLANK counts it. SUMPRODUCT(--ISBLANK(range))
and COUNTBLANK(range) therefore disagree exactly on the empty-text cells, and that disagreement
is the cleanest available diagnostic for how many such cells a range holds.
AREAS, ISFORMULA, FORMULATEXT, SUBTOTAL, AGGREGATE — named in the upstream record as
the same-direction reference-sensitive surfaces that also reject array substitutes. They are the
family COUNTBLANK belongs to structurally, even though it is filed with the counting functions.