{
  "category": "Lookup and reference functions",
  "display_name": "ROWS",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.ROWS",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Of 975 recorded answers (975 workbook cells), 22 do not match: 6 differ in kind or value, 16 are refused.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "differs",
    "state_label": "Known larger differences",
    "summary": "Known larger differences on 22 of 975 recorded answers",
    "workbook_corpus": {
      "cells": 979,
      "matched": 953,
      "other_mismatch": 6,
      "pending": 4,
      "refused": 16
    }
  },
  "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#L218-L224",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/lookup.rs#L1810-L1819"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/lookup::eager",
        "catalogue/lookup::pattern",
        "catalogue/lookup::matches",
        "catalogue/lookup::Line::len",
        "catalogue/lookup::Line::scan",
        "catalogue/lookup::reader",
        "catalogue/lookup::cell_value",
        "catalogue/lookup::rows",
        "catalogue/lookup::columns",
        "catalogue/lookup::value",
        "catalogue/lookup::span",
        "catalogue/lookup::shape",
        "catalogue/lookup::index_number",
        "catalogue/lookup::index",
        "catalogue/lookup::selector",
        "catalogue/lookup::indexed",
        "catalogue/lookup::select",
        "catalogue/lookup::row",
        "catalogue/lookup::column",
        "catalogue/lookup::position_of",
        "catalogue/lookup::extent",
        "catalogue/lookup::areas"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/lookup.rs#L218-L224",
      "state": "differs",
      "suite": null,
      "summary": "Known larger differences on 22 of 975 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.ROWS.json",
  "name": "ROWS",
  "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- **`COLUMNS`** is the transpose: the horizontal extent, same shape of answer.\n- **`ROW`** is the coordinate function, not the count function — see above.\n- **`SEQUENCE(ROWS(x))`** is the modern idiom for \"one index per row of `x`\", replacing\n  `ROW(INDIRECT(...))`.\n- **`TRIMRANGE`** answers the question people often ask `ROWS` by mistake: how big is the\n  *populated* part of this range.\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n\n- The answer must be a scalar, always. Returning a 1×1 array is wrong in a way that will not\n  show up until the result is nested inside something shape-sensitive.\n- The argument must not be dereferenced. `ROWS` of a whole column must not require reading a\n  million cells.\n- The 1×1-array-versus-scalar distinction is load-bearing. Argument preparation normally\n  collapses a single-cell reference to a scalar; `ROWS` needs the shape that existed before\n  that collapse, or it needs the reference itself.\n- Whole-column and whole-row answers are grid-size dependent and therefore workbook-\n  compatibility dependent. Hard-coding the modern grid's row count makes the function silently\n  wrong on legacy workbooks.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nThe return kind is always a scalar number — never an array, whatever the argument's shape.\n\n- **Whole-column references** return the grid's full row count, which differs between the\n  modern grid and an `.xls`-compatibility workbook. `ROWS(A:A)` is a version-scoped answer.\n- **Multi-area references** are not described by the documentation, and the Handbook has not\n  verified what `ROWS` does with a union.\n- Reference resolution, and the fact that `ROWS` inspects the reference rather than its values,\n  are covered in [the call pipeline](../model/03-call-pipeline.md).\n\n\n\n### Errors\n\n\nMicrosoft's documentation for `ROWS` names no error values. Observable failures come from\nelsewhere: a `#REF!` reference propagates, and an argument of the wrong kind is refused at\nentry.\n\nWhether an *error value* passed directly (`ROWS(#N/A)`) propagates or is treated as a 1×1\nshape is not documented, and the Handbook has not verified it.\n\n\n",
    "sources": "- Microsoft, *ROWS function* —\n  <https://support.microsoft.com/en-us/office/rows-function-b592593e-3fc2-47f2-bec1-bda493811597>\n  (syntax and the row-count definition). Not retrieved for this page; the behaviour above is\n  stated as documented behaviour and should be re-checked against the page.\n- Handbook `content/model/01-value-universe.md` and `content/model/03-call-pipeline.md`.\n- Handbook `data/functions/FUNC.ROWS.json` (signature, arity, classification axes).\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`ROWS` returns the number of rows in its argument, as a scalar number.\n\nFor a reference, that is the row span of the referenced area: `ROWS(A5:C9)` is `5`. For a\nsingle cell it is `1`. For an array — a literal, a dynamic-array result, or the value returned\nby another function — it is the array's first dimension: `ROWS({1,2;3,4})` is `2`.\n\nThe whole function is that one sentence, which is why it is worth being exact about the two\nthings it is *not*:\n\n- **It is not `ROW`.** `ROW` reports *which* rows; `ROWS` reports *how many*. `ROW(A5:A8)` is\n  the array `{5;6;7;8}`; `ROWS(A5:A8)` is `4`.\n- **It does not count populated rows.** `ROWS` measures the shape of the reference, not its\n  contents. A range with three blank rows in the middle still has its full row count. Counting\n  data is `COUNTA`'s job, and mistaking one for the other is the usual source of off-by-many\n  errors in \"dynamic range\" formulas.\n\nThe function's real importance is structural: it is how a formula asks about the *shape* of\nsomething it was handed. `ROWS` and `COLUMNS` are the shape-introspection primitives that make\ngeneric array formulas possible, and they are what a `LAMBDA` uses to size its own work.\n\n\n\n### Arguments\n\n\n**`array`** — required, exactly one. A reference or an array whose row count is wanted. Both\nargument kinds are admissible: the argument name in the signature says `array`, but a reference\nis equally valid, and in practice references are the common case.\n\n"
  },
  "signature": {
    "display": "ROWS(array)",
    "parameters": [
      {
        "description": null,
        "name": "array",
        "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": "WorkbookState",
        "kernel_signature_class": "Custom",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "RefOnly",
        "thread_safety_class": "HostSerialized",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "How many rows an array or reference has",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the number of rows in a reference",
        "microsoft_url": "https://support.microsoft.com/en-us/office/rows-function-b592593e-3fc2-47f2-bec1-bda493811597"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "ROWS"
        },
        {
          "locale": "bg-BG",
          "name": "ROWS"
        },
        {
          "locale": "cs-CZ",
          "name": "ROWS"
        },
        {
          "locale": "da-DK",
          "name": "RÆKKER"
        },
        {
          "locale": "de-DE",
          "name": "ROWS"
        },
        {
          "locale": "el-GR",
          "name": "ROWS"
        },
        {
          "locale": "en-AU",
          "name": "ROWS"
        },
        {
          "locale": "en-GB",
          "name": "ROWS"
        },
        {
          "locale": "en-US",
          "name": "ROWS"
        },
        {
          "locale": "es-ES",
          "name": "FILAS"
        },
        {
          "locale": "et-EE",
          "name": "ROWS"
        },
        {
          "locale": "fi-FI",
          "name": "RIVIT"
        },
        {
          "locale": "fr-FR",
          "name": "ROWS"
        },
        {
          "locale": "he-IL",
          "name": "ROWS"
        },
        {
          "locale": "hr-HR",
          "name": "ROWS"
        },
        {
          "locale": "hu-HU",
          "name": "ROWS"
        },
        {
          "locale": "id-ID",
          "name": "ROWS"
        },
        {
          "locale": "it-IT",
          "name": "ROWS"
        },
        {
          "locale": "ja-JP",
          "name": "ROWS"
        },
        {
          "locale": "ko-KR",
          "name": "ROWS"
        },
        {
          "locale": "lt-LT",
          "name": "ROWS"
        },
        {
          "locale": "lv-LV",
          "name": "ROWS"
        },
        {
          "locale": "nb-NO",
          "name": "ROWS"
        },
        {
          "locale": "nl-NL",
          "name": "ROWS"
        },
        {
          "locale": "pl-PL",
          "name": "ROWS"
        },
        {
          "locale": "pt-BR",
          "name": "ROWS"
        },
        {
          "locale": "pt-PT",
          "name": "ROWS"
        },
        {
          "locale": "ro-RO",
          "name": "ROWS"
        },
        {
          "locale": "ru-RU",
          "name": "ROWS"
        },
        {
          "locale": "sk-SK",
          "name": "ROWS"
        },
        {
          "locale": "sl-SI",
          "name": "ROWS"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "ROWS"
        },
        {
          "locale": "sv-SE",
          "name": "ROWS"
        },
        {
          "locale": "th-TH",
          "name": "ROWS"
        },
        {
          "locale": "tr-TR",
          "name": "SATIRSAY"
        },
        {
          "locale": "uk-UA",
          "name": "ROWS"
        },
        {
          "locale": "vi-VN",
          "name": "ROWS"
        },
        {
          "locale": "zh-CN",
          "name": "ROWS"
        },
        {
          "locale": "zh-HK",
          "name": "ROWS"
        },
        {
          "locale": "zh-TW",
          "name": "ROWS"
        }
      ],
      "signature": {
        "display": "ROWS(array)",
        "parameters": [
          {
            "description": null,
            "name": "array",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "ROWS",
      "version_marker": null,
      "xlcall": {
        "code": "76",
        "symbol": "xlfRows"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/rows-function-b592593e-3fc2-47f2-bec1-bda493811597"
  },
  "try_it": {
    "formula": "=ROWS(B2:C4)",
    "inputs": {
      "B2": 1,
      "B3": 2,
      "B4": 3,
      "C2": 10,
      "C3": 20,
      "C4": 30
    }
  },
  "url": "https://handbook.dnacalc.com/functions/ROWS.html",
  "variants": [],
  "versions": []
}