{
  "category": "Lookup and reference functions",
  "display_name": "AREAS",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.AREAS",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Recorded: 11 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 11 recorded answers",
    "workbook_corpus": {
      "cells": 13,
      "matched": 11,
      "pending": 2
    }
  },
  "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/lookup.rs#L232-L238"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/lookup::eager",
        "catalogue/lookup::areas"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/lookup.rs#L232-L238",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 11 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.AREAS.json",
  "name": "AREAS",
  "notes": [],
  "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- **`ROWS` and `COLUMNS`** measure a reference's extent; `AREAS` measures its cardinality. The\n  three together describe a reference's shape.\n- **`INDEX`'s reference form** is the main consumer of multi-area references: its fourth\n  argument, `area_num`, selects which area to index into. `AREAS` is how you find out how many\n  there are to choose from. The pairing `INDEX(ref, r, c, AREAS(ref))` — take the last area —\n  is the idiom that makes `AREAS` more than a curiosity.\n- **The union operator** (`FUNC.OP_UNION_REF` in the Handbook's operator catalog) is what\n  creates the structure `AREAS` reports. The intersection operator can also produce references,\n  and whether an intersection result ever has more than one area is an open question here.\n- **`OFFSET` and `INDIRECT`** produce references at evaluation time; whether a reference so\n  produced can carry multiple areas is a further open question.\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n\n- **Reference structure must be preserved end to end.** Any implementation that normalizes a\n  reference — sorting, merging adjacent rectangles, deduplicating overlaps — before `AREAS`\n  sees it will produce a different, and probably wrong, count. This is the standard trap for\n  engines that canonicalize references early for dependency tracking.\n- **The comma is context-sensitive** in the formula grammar: argument separator at one level,\n  union operator inside a parenthesized reference expression. The argument separator is\n  locale-dependent (semicolon in many locales) while the union operator's spelling is tied to\n  it. A formula parser has to get the interaction right or `AREAS((A1,B1))` will not survive a\n  locale round trip. Formula grammar is out of the Handbook's declared scope, but the collision\n  lands on this function's doorstep.\n- The function is classified `fec_dependency_profile: RefOnly` — it needs the reference\n  facility but nothing else about the workbook: no cell values are read, so no dereference of\n  the areas is required to answer.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturn kind: `Number` — a positive integer count.\n\nBoundary cases specific to this function, none of which the Handbook has established for Excel:\n\n- **A whole-column or whole-row reference** (`A:A`, `3:3`) — one area, presumably, but the\n  answer is worth recording rather than assuming.\n- **A three-dimensional reference** (`Sheet1:Sheet3!A1`) — does the sheet span multiply the\n  count, or is it one area spanning sheets? The [value universe](../model/01-value-universe.md)\n  lists three-dimensional as its own reference shape, which is precisely why the answer is not\n  derivable from the other shapes.\n- **A spill anchor** (`B1#`) — a reference shape that postdates the function by decades.\n- **A structured reference** (`Table1[Amount]`), including the multi-column and\n  non-contiguous-column forms, which can designate more than one rectangle.\n- **Overlapping and adjacent unions**, which test whether the count is structural (as stated\n  above) or normalized.\n\n\n\n### Errors\n\n\nMicrosoft's page documents the argument as a reference to a cell or range of cells that can\nrefer to multiple areas. It does not publish an error table. The expected failure is the\nnon-reference argument — `AREAS(5)`, `AREAS(\"A1:B2\")` — for which `#VALUE!` is the conventional\ncode in this family; the Handbook records that as expected, not as verified. An error value\nsupplied as the argument propagates under the universal rule in\n[coercion and lifting](../model/02-coercion-and-lifting.md).\n\nNote that text that *looks* like a reference is not a reference. `AREAS(\"A1:B2\")` asks the\nfunction to count areas in a string. If you have address text, `INDIRECT` is the conversion\nstep, and it brings its own consequences.\n\n\n",
    "sources": "\n- Microsoft, AREAS function —\n  <https://support.microsoft.com/en-us/office/areas-function-8392ba32-7a41-43b3-96b0-3695d2ec6152>\n  (argument definition, and the double-parenthesis requirement for inline unions).\n- Handbook `content/model/01-value-universe.md` (reference shapes: area, multi-area,\n  three-dimensional, structured, spill anchor).\n- Handbook `content/model/02-coercion-and-lifting.md` (error propagation; references at the\n  call boundary).\n- Handbook `content/model/03-call-pipeline.md` (`RefsVisibleInAdapter`; operators as\n  functions).\n- Handbook `data/functions/FUNC.AREAS.json` and `data/presence/FUNC.AREAS.json` (arity,\n  classification axes, implementing module).\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`AREAS` counts the **rectangles** in a reference. A reference in the Excel value model is not\nalways one block: the union operator (the comma, in the default English locale) joins several\ndisjoint rectangles into a single multi-area reference, and `AREAS` reports how many rectangles\nthat union contains.\n\nThe count is structural, not geometric. `AREAS` does not merge rectangles that happen to be\nadjacent, and it does not deduplicate rectangles that overlap — it reports how the reference was\nbuilt. Two rectangles that together tile a larger rectangle still count as two.\n\nA single cell and a single rectangular range are both one area, so the answer is at least 1 for\nany reference. The interesting inputs are all unions.\n\n\n\n### Arguments\n\n\n| Argument | Meaning |\n|---|---|\n| `reference` | A reference, or a name that resolves to one. Required, and it must genuinely be a reference — a value cannot be counted. |\n\nThe one thing every reader gets wrong once: **a union written inline needs a second set of\nparentheses.** `AREAS(A1:C4,E5)` is not a one-argument call with a union in it; it parses as two\narguments, which is outside the function's arity of exactly 1. The union must be parenthesized\ninto a single argument — `AREAS((A1:C4,E5))` — so that the comma is read by the reference\nalgebra rather than by the argument list. Microsoft's page makes the same point in its examples.\nThis is a formula-grammar collision, not a quirk of `AREAS`: it applies to any function that\ntakes a reference in a position where a comma would otherwise separate arguments.\n\n\n"
  },
  "signature": {
    "display": "AREAS(reference)",
    "parameters": [
      {
        "description": null,
        "name": "reference",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 1,
        "min": 1
      },
      "category": "Lookup and reference functions",
      "classification": {
        "arg_preparation_profile": "RefsVisibleInAdapter",
        "coercion_lift_profile": "Custom",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "RefOnly",
        "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 separate areas a reference covers",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the number of areas in a reference",
        "microsoft_url": "https://support.microsoft.com/en-us/office/areas-function-8392ba32-7a41-43b3-96b0-3695d2ec6152"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "المناطق"
        },
        {
          "locale": "bg-BG",
          "name": "AREAS"
        },
        {
          "locale": "cs-CZ",
          "name": "POČET.BLOKŮ"
        },
        {
          "locale": "da-DK",
          "name": "OMRÅDER"
        },
        {
          "locale": "de-DE",
          "name": "BEREICHE"
        },
        {
          "locale": "el-GR",
          "name": "AREAS"
        },
        {
          "locale": "en-AU",
          "name": "AREAS"
        },
        {
          "locale": "en-GB",
          "name": "AREAS"
        },
        {
          "locale": "en-US",
          "name": "AREAS"
        },
        {
          "locale": "es-ES",
          "name": "AREAS"
        },
        {
          "locale": "et-EE",
          "name": "AREAS"
        },
        {
          "locale": "fi-FI",
          "name": "ALUEILLA"
        },
        {
          "locale": "fr-FR",
          "name": "ZONES*"
        },
        {
          "locale": "he-IL",
          "name": "AREAS"
        },
        {
          "locale": "hr-HR",
          "name": "AREAS"
        },
        {
          "locale": "hu-HU",
          "name": "TERÜLET"
        },
        {
          "locale": "id-ID",
          "name": "AREAS"
        },
        {
          "locale": "it-IT",
          "name": "AREAS"
        },
        {
          "locale": "ja-JP",
          "name": "AREAS"
        },
        {
          "locale": "ko-KR",
          "name": "AREAS"
        },
        {
          "locale": "lt-LT",
          "name": "AREAS"
        },
        {
          "locale": "lv-LV",
          "name": "AREAS"
        },
        {
          "locale": "nb-NO",
          "name": "OMRÅDER"
        },
        {
          "locale": "nl-NL",
          "name": "AREAS"
        },
        {
          "locale": "pl-PL",
          "name": "OBSZARY"
        },
        {
          "locale": "pt-BR",
          "name": "ÁREAS"
        },
        {
          "locale": "pt-PT",
          "name": "ÁREAS"
        },
        {
          "locale": "ro-RO",
          "name": "AREAS"
        },
        {
          "locale": "ru-RU",
          "name": "ОБЛАСТИ"
        },
        {
          "locale": "sk-SK",
          "name": "AREAS"
        },
        {
          "locale": "sl-SI",
          "name": "PODROČJA"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "OBLASTI"
        },
        {
          "locale": "sv-SE",
          "name": "OMRÅDEN"
        },
        {
          "locale": "th-TH",
          "name": "AREAS"
        },
        {
          "locale": "tr-TR",
          "name": "ALANSAY işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "AREAS"
        },
        {
          "locale": "vi-VN",
          "name": "AREAS"
        },
        {
          "locale": "zh-CN",
          "name": "AREAS"
        },
        {
          "locale": "zh-HK",
          "name": "AREAS"
        },
        {
          "locale": "zh-TW",
          "name": "AREAS"
        }
      ],
      "signature": {
        "display": "AREAS(reference)",
        "parameters": [
          {
            "description": null,
            "name": "reference",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "AREAS",
      "version_marker": null,
      "xlcall": {
        "code": "75",
        "symbol": "xlfAreas"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/areas-function-8392ba32-7a41-43b3-96b0-3695d2ec6152"
  },
  "try_it": {
    "formula": "=AREAS((B2:B4,D2:D4))",
    "inputs": {
      "B2": 1,
      "B3": 2,
      "B4": 3,
      "D2": 1,
      "D3": 1,
      "D4": 2
    }
  },
  "url": "https://handbook.dnacalc.com/functions/AREAS.html",
  "variants": [],
  "versions": []
}