{
  "category": "Statistical functions",
  "display_name": "COUNTBLANK",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.COUNTBLANK",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Recorded: 14 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 14 recorded answers",
    "workbook_corpus": {
      "cells": 15,
      "matched": 14,
      "pending": 1
    }
  },
  "implementations": [
    {
      "commit": "9e1884369a678158dd82d3d74188daf986995e87",
      "flavour": "excel-compatibility-candidate",
      "language": "Rust",
      "name": "CalcFunc",
      "own_code": [
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/aggregate.rs#L102-L110",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/aggregate.rs#L436-L449",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/aggregate.rs#L451-L495"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/aggregate::reader",
        "catalogue/aggregate::read_reference"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/aggregate.rs#L102-L110",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 14 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.COUNTBLANK.json",
  "name": "COUNTBLANK",
  "notes": [
    {
      "basis": "One recorded reading.",
      "documentation": null,
      "evidence": [
        {
          "commit": "eceb809985e244e9d0a20f905e58fe57b8741ed8",
          "locator": "sheet fn2_q187",
          "note": null,
          "path": "crates/calc-func/tests/captures/fn2_questions/oracle.capture.json",
          "repository": "DnaCalc"
        },
        {
          "commit": "1cccd45a8e55db2363b6afeefa1505fc645d8dbe",
          "locator": "recorded_countblank_optional_lambda_omission_is_a_value_error",
          "note": "recorded answer pinned",
          "path": "apps/dna-onecalc/tests/acceptance.rs",
          "repository": "DnaCalc"
        }
      ],
      "functions": [
        "FUNC.COUNTBLANK"
      ],
      "inferred": "That this holds for missing values in general is inferred.",
      "kind": "quirk",
      "note_id": "FN-COUNTBLANK-001",
      "open": [],
      "recorded_on": "2026-11-04",
      "repros": [
        {
          "call": "=LAMBDA([xx],COUNTBLANK(xx))()",
          "correct": null,
          "excel": {
            "bits": null,
            "display": "#VALUE!",
            "kind": "error"
          },
          "input_route": "formula-literal",
          "inputs": [],
          "recorded_in": "Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA",
          "source": {
            "commit": "eceb809985e244e9d0a20f905e58fe57b8741ed8",
            "locator": "sheet fn2_q187, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn2_questions/oracle.capture.json",
            "repository": "DnaCalc"
          }
        }
      ],
      "schema": "efh.function-note/v1",
      "statement": "An optional LAMBDA parameter left out reaches COUNTBLANK as a missing value, and the result is #VALUE!, not a count of 1.",
      "status": "measured",
      "title": "COUNTBLANK of an omitted optional LAMBDA parameter is #VALUE!"
    }
  ],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n### Relationships\n\n\n- **[COUNTA](FUNC.COUNTA.md)** — the near-complement that is not a complement, because both count\n  empty-text cells. The pair is the clearest illustration in Excel that \"blank\" is not one concept.\n- **`COUNT`** — counts numbers only; `0` counts there and does not count here, which\n  is the one place all three functions agree in spirit.\n- **`COUNTIF`** — `COUNTIF(range,\"\")` and `COUNTIF(range,\"<>\")` are the usual\n  attempted substitutes. They run the criteria matcher's own blank-and-empty-text rules, which are\n  a third definition again, so they are not reliable stand-ins. If you need a specific definition of\n  blank, write it explicitly with `ISBLANK` or `LEN`.\n- **[ISBLANK](FUNC.ISBLANK.md)** — the per-cell predicate, and a *fourth* definition: `ISBLANK` is\n  false for a formula returning `\"\"`, where `COUNTBLANK` counts it. `SUMPRODUCT(--ISBLANK(range))`\n  and `COUNTBLANK(range)` therefore disagree exactly on the empty-text cells, and that disagreement\n  is the cleanest available diagnostic for how many such cells a range holds.\n- **`AREAS`, `ISFORMULA`, `FORMULATEXT`, `SUBTOTAL`, `AGGREGATE`** — named in the upstream record as\n  the same-direction reference-sensitive surfaces that also reject array substitutes. They are the\n  family `COUNTBLANK` belongs to structurally, even though it is filed with the counting functions.\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n1. **Take the reference, not the values.** Resolving to values first destroys the information the\n   function needs: you cannot count cells that never existed as values. This is why the surface is\n   declared reference-visible at the adapter.\n3. **Reject arrays deliberately.** It is tempting to reuse the aggregate expansion helper that\n   serves `COUNT` and `COUNTA`; that is precisely the mistake the upstream bug stream records, and\n   the root-cause note calls it inheriting an over-permissive shape rather than a regression.\n5. **Empty text is a Text value.** The predicate is \"is this Text of zero length\", not \"does this\n   render as nothing\". A number formatted to display nothing is not blank.\n\n\n",
    "quirks": "\n### The signature divergence\n\n2. Excel accepts several ranges undocumented, and the documentation is narrow.\n3. Excel accepts several arguments but the documentation describes the supported usage.\n\n`=COUNTBLANK(A1:A3, C1:C3)` in a live Excel decides it in one cell. It is the first probe listed\nbelow, and it is the kind of question this Handbook exists to publish rather than guess at.\n\n\n\n### Result and edge cases\n\n\nReturns `Number` — a non-negative integer count.\n\n- **Zero is not blank.** Documented. This is the rule that makes `COUNTBLANK` usable on numeric\n  columns where `0` is a real observation.\n- **Never-touched cells inside the range count.** They have no value at all, which is the\n  uncontroversial half of the definition.\n\n\n\n### Errors\n\n\nThe documentation states no error conditions for this function.\n\n| Error | Condition |\n|---|---|\n| `#VALUE!` | An array-valued argument is supplied instead of a range |\n| propagated | An error value in a scanned cell surfaces as the function's result |\n| `#VALUE!` | Argument-count or preparation failure |\n\nThe array-rejection row has the live-Excel anchor described above. The error-propagation row has no\nanchor at all.\n\n\n",
    "sources": "- Handbook call-model chapters [01 The value universe](../model/01-value-universe.md) (Empty as a\n  value kind; the raw-versus-published boundary) and\n  [02 Coercion and lifting](../model/02-coercion-and-lifting.md) (reference resolution as an\n  explicit step; error propagation as a per-family declaration).\n- Handbook projections `data/functions/FUNC.COUNTBLANK.json` — which records the documented\n  `COUNTBLANK(range)` display signature alongside an arity of minimum 1 and maximum 255, the\n  divergence discussed above — and `data/presence/FUNC.COUNTBLANK.json`.\n\n\n",
    "version-differences": "No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.",
    "what-it-does": "\n`COUNTBLANK(range)` counts the cells in a range that are **blank**, where blank has a specific\ndocumented meaning that is not the same as \"empty\".\n\nMicrosoft's page states the rule in two sentences: cells with formulas that return `\"\"` (empty\ntext) are also counted, and cells with zero values are not counted. So:\n\n| Cell content | Counted as blank? |\n|---|---|\n| Nothing at all | yes |\n| A formula returning `\"\"` | yes |\n| A literal empty string | yes, on the same rule |\n| `0` | no |\n| Any other number, text, or logical | no |\n| An error value | not documented — see below |\n\nThe definition is therefore *display-shaped* rather than *content-shaped*: a cell counts as blank if\nit shows nothing, even when it contains a formula. That is a defensible choice for the job the\nfunction exists to do — finding gaps in a data-entry region — and it is the reason `COUNTBLANK` is\nnot the complement of [COUNTA](FUNC.COUNTA.md).\n\n**The arithmetic that surprises people.** `COUNTA` counts a `\"\"` cell (it contains information) and\n`COUNTBLANK` counts the same cell (it displays nothing). So for a range `r`,\n\n    COUNTA(r) + COUNTBLANK(r)  ≥  ROWS(r) * COLUMNS(r)\n\nwith equality only when no cell holds empty text. Two functions, two definitions of blank, both\ndocumented, both correct on their own terms. Anyone reconciling a count should decide which\ndefinition they mean before choosing a function.\n\n\n\n### Arguments\n\n\n`COUNTBLANK(range)` — one argument.\n\n| Argument | Meaning (as documented) |\n|---|---|\n| `range` | \"The range from which you want to count the blank cells\" |\n\nMicrosoft's page states plainly that the function accepts one argument. The argument is a *range*,\nnot a value: this is a reference-sensitive surface, and the distinction is load-bearing rather than\nstylistic — see the next section.\n\n"
  },
  "signature": {
    "display": "COUNTBLANK(range)",
    "parameters": [
      {
        "description": null,
        "name": "range",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 1,
        "min": 1
      },
      "category": "Statistical functions",
      "classification": {
        "arg_preparation_profile": "RefsVisibleInAdapter",
        "coercion_lift_profile": "AggregateDirectAndRangeDualPolicy",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "None",
        "host_interaction_class": "None",
        "kernel_signature_class": "Custom",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "RefOnly",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "How many cells of a range are empty",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Counts the number of blank cells within a range",
        "microsoft_url": "https://support.microsoft.com/en-us/office/countblank-function-6a92d772-675c-4bee-b346-24af6bd3ac22"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "COUNTBLANK"
        },
        {
          "locale": "bg-BG",
          "name": "COUNTBLANK"
        },
        {
          "locale": "cs-CZ",
          "name": "COUNTBLANK"
        },
        {
          "locale": "da-DK",
          "name": "ANTAL.BLANKE"
        },
        {
          "locale": "de-DE",
          "name": "COUNTBLANK"
        },
        {
          "locale": "el-GR",
          "name": "COUNTBLANK"
        },
        {
          "locale": "en-AU",
          "name": "COUNTBLANK"
        },
        {
          "locale": "en-GB",
          "name": "COUNTBLANK"
        },
        {
          "locale": "en-US",
          "name": "COUNTBLANK"
        },
        {
          "locale": "es-ES",
          "name": "COUNTBLANK"
        },
        {
          "locale": "et-EE",
          "name": "COUNTBLANK"
        },
        {
          "locale": "fi-FI",
          "name": "LASKE.TYHJÄT"
        },
        {
          "locale": "fr-FR",
          "name": "COUNTBLANK"
        },
        {
          "locale": "he-IL",
          "name": "COUNTBLANK"
        },
        {
          "locale": "hr-HR",
          "name": "COUNTBLANK"
        },
        {
          "locale": "hu-HU",
          "name": "DARABÜRES"
        },
        {
          "locale": "id-ID",
          "name": "COUNTBLANK"
        },
        {
          "locale": "it-IT",
          "name": "COUNTBLANK"
        },
        {
          "locale": "ja-JP",
          "name": "COUNTBLANK"
        },
        {
          "locale": "ko-KR",
          "name": "COUNTBLANK"
        },
        {
          "locale": "lt-LT",
          "name": "COUNTBLANK"
        },
        {
          "locale": "lv-LV",
          "name": "COUNTBLANK"
        },
        {
          "locale": "nb-NO",
          "name": "TELLBLANKE"
        },
        {
          "locale": "nl-NL",
          "name": "AANTAL.LEGE.CELLEN"
        },
        {
          "locale": "pl-PL",
          "name": "LICZ.PUSTE"
        },
        {
          "locale": "pt-BR",
          "name": "CONTAR.VAZIO"
        },
        {
          "locale": "pt-PT",
          "name": "CONTAR.VAZIO"
        },
        {
          "locale": "ro-RO",
          "name": "COUNTBLANK"
        },
        {
          "locale": "ru-RU",
          "name": "COUNTBLANK"
        },
        {
          "locale": "sk-SK",
          "name": "COUNTBLANK"
        },
        {
          "locale": "sl-SI",
          "name": "COUNTBLANK"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "COUNTBLANK"
        },
        {
          "locale": "sv-SE",
          "name": "ANTAL.TOMMA"
        },
        {
          "locale": "th-TH",
          "name": "COUNTBLANK"
        },
        {
          "locale": "tr-TR",
          "name": "BOŞLUKSAY işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "COUNTBLANK"
        },
        {
          "locale": "vi-VN",
          "name": "COUNTBLANK"
        },
        {
          "locale": "zh-CN",
          "name": "COUNTBLANK"
        },
        {
          "locale": "zh-HK",
          "name": "COUNTBLANK"
        },
        {
          "locale": "zh-TW",
          "name": "COUNTBLANK"
        }
      ],
      "signature": {
        "display": "COUNTBLANK(range)",
        "parameters": [
          {
            "description": null,
            "name": "range",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "COUNTBLANK",
      "version_marker": null,
      "xlcall": {
        "code": "347",
        "symbol": "xlfCountblank"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/countblank-function-6a92d772-675c-4bee-b346-24af6bd3ac22"
  },
  "try_it": {
    "formula": "=COUNTBLANK(B2:B4)",
    "inputs": {
      "B2": 1,
      "B3": 2,
      "B4": 3
    }
  },
  "url": "https://handbook.dnacalc.com/functions/COUNTBLANK.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "=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.",
      "excel_build": "16.0.20527.20088",
      "observations": [
        {
          "call": "=LAMBDA([xx],COUNTBLANK(xx))()",
          "excel": {
            "bits": null,
            "display": "#VALUE!",
            "kind": "error"
          },
          "input_route": "formula-literal",
          "inputs": [],
          "recorded_in": "Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA"
        }
      ],
      "platform": "Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/3345a87/content/notes/FN-COUNTBLANK-001.json"
      ]
    }
  ]
}