{
  "category": "Lookup and reference functions",
  "display_name": "VSTACK",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.VSTACK",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Recorded: 12 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 12 recorded answers",
    "workbook_corpus": {
      "cells": 12,
      "matched": 12
    }
  },
  "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/arrays.rs#L666-L670",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/dynamic_array_reshape_family.rs#L528-L548"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/arrays::prepared",
        "catalogue/arrays::prepared_one",
        "catalogue/arrays::result",
        "catalogue/arrays::run",
        "ported/dynamic_array_reshape_family::shape",
        "ported/dynamic_array_reshape_family::get",
        "ported/dynamic_array_reshape_family::build_array",
        "ported/dynamic_array_reshape_family::map_dynamic_array_reshape_error_to_ws"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/arrays.rs#L666-L670",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 12 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.VSTACK.json",
  "name": "VSTACK",
  "notes": [
    {
      "basis": "27 recorded readings in dynamic-array Excel, each with size observers.",
      "documentation": null,
      "evidence": [
        {
          "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
          "locator": "scalar_errors_keep_their_array_argument_origins",
          "note": "recorded readings pinned",
          "path": "apps/dna-onecalc/tests/acceptance.rs",
          "repository": "DnaCalc"
        },
        {
          "commit": "2d0eddcac86413014643af81d646581d54ba57bc",
          "locator": "sheets fn2_q001 to fn2_q007, fn2_q031 to fn2_q042, fn2_q232 to fn2_q239",
          "note": "recorded readings",
          "path": "crates/calc-func/tests/captures/fn2_questions/oracle.capture.json",
          "repository": "DnaCalc"
        }
      ],
      "functions": [
        "FUNC.BYCOL",
        "FUNC.BYROW",
        "FUNC.EXPAND",
        "FUNC.HSTACK",
        "FUNC.MAP",
        "FUNC.TAKE",
        "FUNC.TOCOL",
        "FUNC.TOROW",
        "FUNC.VSTACK"
      ],
      "inferred": null,
      "kind": "quirk",
      "note_id": "FN-HSTACK-001",
      "open": [
        "Competing errors in later positions have not been read in a published capture."
      ],
      "recorded_on": "2026-11-04",
      "repros": [
        {
          "call": "=HSTACK(1,#VALUE!)",
          "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": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet fn2_q004, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn2_questions/oracle.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=TAKE(#N/A,0)",
          "correct": null,
          "excel": {
            "bits": null,
            "display": "#N/A",
            "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": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet fn2_q232, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn2_questions/oracle.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=MAP(NA(),LAMBDA(xx,IFERROR(xx,3)))",
          "correct": null,
          "excel": {
            "bits": null,
            "display": "#N/A",
            "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": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet fn2_q031, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn2_questions/oracle.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=MAP({#N/A},LAMBDA(xx,3))",
          "correct": null,
          "excel": {
            "bits": "0x4008000000000000",
            "display": "3",
            "kind": "number"
          },
          "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": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet fn2_q032, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn2_questions/oracle.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=HSTACK(Data!C1,{1;2})",
          "correct": null,
          "excel": {
            "bits": null,
            "display": "{#N/A,1;#N/A,2}",
            "kind": "array"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "Data!C1",
              "value": {
                "bits": null,
                "display": "#N/A",
                "kind": "error"
              }
            }
          ],
          "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": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet fn2_q238, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn2_questions/oracle.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=TOCOL(#N/A,2)",
          "correct": null,
          "excel": {
            "bits": null,
            "display": "#N/A",
            "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": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet fn2_q233, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn2_questions/oracle.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=TOCOL({#N/A},2)",
          "correct": null,
          "excel": {
            "bits": null,
            "display": "#CALC!",
            "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": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet fn2_q234, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn2_questions/oracle.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=EXPAND(Data!C1,2,2,\"pad\")",
          "correct": null,
          "excel": {
            "bits": null,
            "display": "#N/A",
            "kind": "error"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "Data!C1",
              "value": {
                "bits": null,
                "display": "#N/A",
                "kind": "error"
              }
            }
          ],
          "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": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet fn2_q237, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn2_questions/oracle.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=BYROW(#N/A,#VALUE!)",
          "correct": null,
          "excel": {
            "bits": null,
            "display": "#N/A",
            "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": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet fn2_q040, row 20, column 10",
            "note": null,
            "path": "crates/calc-func/tests/captures/fn2_questions/oracle.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=BYROW({#N/A},2)",
          "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": "2d0eddcac86413014643af81d646581d54ba57bc",
            "locator": "sheet fn2_q038, 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 error written directly as an argument of these functions is the answer for the whole call. It is not placed in the result: HSTACK(1,#VALUE!) is #VALUE!, not a row holding 1 and an error, and TAKE(#N/A,0) is #N/A. With MAP the LAMBDA does not run at all: MAP(NA(),LAMBDA(xx,IFERROR(xx,3))) is #N/A. The same error inside an array, or in a referenced cell, is an ordinary element: MAP({#N/A},LAMBDA(xx,3)) is 3, and HSTACK(Data!C1,{1;2}) with #N/A in Data!C1 is a 2 by 2 array with #N/A in its first column. TOCOL and TOROW show the difference with ignore 2: TOCOL(#N/A,2) is #N/A, while TOCOL({#N/A},2) drops the error, has nothing left, and is #CALC!. EXPAND is an exception on the cell side: EXPAND(Data!C1,2,2,\"pad\") is #N/A for the whole call. BYROW and BYCOL check the direct error first too: BYROW(#N/A,#VALUE!) is #N/A, while BYROW({#N/A},2), where 2 is not a LAMBDA, is #VALUE!.",
      "status": "measured",
      "title": "A direct error stops these array functions; the same error in an array or cell is an element"
    }
  ],
  "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- **`HSTACK`** is the horizontal twin: columns sum, rows take the maximum, and short arrays are\n  padded **below** with `#N/A`. The two are exact transposes of each other, and\n  `TRANSPOSE(VSTACK(TRANSPOSE(a), TRANSPOSE(b)))` is `HSTACK(a, b)`.\n- **`TOCOL` / `TOROW`** flatten an array into one vector; `VSTACK` preserves two-dimensional\n  structure. Stacking single-column arrays with `VSTACK` and flattening with `TOCOL` produce\n  different things whenever the inputs are wider than one column.\n- **`WRAPROWS` / `WRAPCOLS`** are the inverse direction: one vector to a rectangle.\n- **`EXPAND`** pads a single array to a given size with a chosen filler, which is the explicit\n  form of what `VSTACK` does implicitly.\n- The array literal `{1,2;3,4}` and the `;` row separator are the static equivalents.\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n- Compute the target width first, then copy; the padding must be materialized, not implied,\n  because the result is a dense rectangular array.\n- The pad value is `#N/A` specifically, not a generic error and not a blank. An implementation\n  that pads with empty produces a result that looks right and sums differently.\n- Argument order defines row order. Stacking is not commutative.\n- The result of stacking a large number of arguments is the natural place for an array-size\n  limit check; the limit is a host property, not a kernel property.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nThe return kind is an array, spilled.\n\n- **Single argument.** `VSTACK(A)` returns `A`. It is a legal, if pointless, call, and it is a\n  useful shape probe.\n- **Scalars.** A scalar argument behaves as a 1×1 array and contributes one row.\n- **The `#N/A` padding is part of the value**, not a display artifact: it participates in\n  downstream arithmetic and comparisons exactly as any `#N/A` does.\n- **Error values inside the inputs** are carried through unchanged. `VSTACK` moves values; it\n  does not inspect them. An error written directly as an argument is different: it is the answer\n  for the whole call (FN-HSTACK-001).\n- **Very large results** hit the grid and the array-size limits; the documentation for adjacent\n  reshaping functions names `#NUM!` for oversized arrays, and whether `VSTACK` uses the same\n  outcome is not something the Handbook has verified.\n- Dynamic-array publication and `#SPILL!` are host-side adaptation, described in\n  [the call pipeline](../model/03-call-pipeline.md).\n\n\n\n### Errors\n\n\nThe `#N/A` values in the padded region are documented as the *expected result* of stacking\nunequal widths, not as a failure — an important distinction for anyone writing a test oracle:\na result containing `#N/A` is not necessarily an error case.\n\nMicrosoft's page documents no error return for `VSTACK` itself beyond that padding, and\nsuggests `IFERROR` as the mitigation. `#SPILL!` arises at publication when the result cannot be\nplaced.\n\n\n",
    "sources": "- Microsoft, *VSTACK function* —\n  <https://support.microsoft.com/en-us/office/vstack-function-a4b86897-be0f-48fc-adca-fcc10d795a9c>\n  (syntax, the sum-of-rows / max-of-columns result dimensions, the `#N/A` padding for narrower\n  arrays, and the `IFERROR` mitigation). Retrieved for this page.\n- Handbook `content/model/01-value-universe.md` and `content/model/03-call-pipeline.md`.\n- Handbook `data/functions/FUNC.VSTACK.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`VSTACK` concatenates its array arguments **vertically**, in argument order.\n\nGiven arrays `A₁ … A_p` with dimensions `m₁ × n₁ … m_p × n_p`, the result has\n\n- **rows** `m₁ + m₂ + … + m_p` — the sum,\n- **columns** `max(n₁, …, n_p)` — the maximum,\n\nwith `A_k`'s rows appearing in order, starting at result row `m₁ + … + m_{k-1} + 1`.\n\nThe interesting part is the second dimension. Stacking arrays of unequal width is not an error\nand not a truncation: **the narrow arrays are padded on the right with `#N/A`**. That choice is\nworth pausing on. Excel could have refused, or padded with blanks, or padded with zeros. It\npads with an error value, which means the padding is *self-announcing* — it shows up in the\nresult rather than blending into it, and it propagates through arithmetic instead of quietly\ncontributing `0`.\n\nThe practical consequence is the idiom Microsoft itself recommends: wrap the call in `IFERROR`\nto substitute your own filler. That works, and it also silently swallows any genuine `#N/A`\nthat came from the data. Whether that trade is acceptable is the caller's decision, and it is\nworth making consciously.\n\n\n\n### Arguments\n\nThere are no option flags. `VSTACK` has exactly one behaviour, which is unusual in this family\nand makes it easy to reason about.\n\nThe position most often misunderstood is not an argument at all but the *shape contract*: many\nreaders expect `VSTACK` to require equal widths, discover that it does not, and only later find\nthe `#N/A` padding in the corner of a wide result. There is no argument that turns the padding\noff.\n\n\n"
  },
  "signature": {
    "display": "VSTACK(array1, [array2], ...)",
    "parameters": [
      {
        "description": null,
        "name": "array1",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "array2",
        "optional": true,
        "repeats": true
      }
    ],
    "trailing_repeats": true
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 254,
        "min": 1
      },
      "category": "Lookup and reference functions",
      "classification": {
        "arg_preparation_profile": "ValuesOnlyPreAdapter",
        "coercion_lift_profile": "Custom",
        "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": "Arrays placed one above another into one array",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Appends arrays vertically and in sequence to return a larger array",
        "microsoft_url": "https://support.microsoft.com/en-us/office/vstack-function-a4b86897-be0f-48fc-adca-fcc10d795a9c"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "VSTACK"
        },
        {
          "locale": "bg-BG",
          "name": "VSTACK"
        },
        {
          "locale": "cs-CZ",
          "name": "SROVNAT.SVISLE"
        },
        {
          "locale": "da-DK",
          "name": "LSTAK"
        },
        {
          "locale": "de-DE",
          "name": "VSTACK"
        },
        {
          "locale": "el-GR",
          "name": "VSTACK"
        },
        {
          "locale": "en-AU",
          "name": "VSTACK"
        },
        {
          "locale": "en-GB",
          "name": "VSTACK"
        },
        {
          "locale": "en-US",
          "name": "VSTACK"
        },
        {
          "locale": "es-ES",
          "name": "APILARV"
        },
        {
          "locale": "et-EE",
          "name": "VSTACK"
        },
        {
          "locale": "fi-FI",
          "name": "VPINO"
        },
        {
          "locale": "fr-FR",
          "name": "ASSEMB.V*"
        },
        {
          "locale": "he-IL",
          "name": "VSTACK"
        },
        {
          "locale": "hr-HR",
          "name": "VSTACK"
        },
        {
          "locale": "hu-HU",
          "name": "FÜGG.HALMOZÁS"
        },
        {
          "locale": "id-ID",
          "name": "VSTACK"
        },
        {
          "locale": "it-IT",
          "name": "VSTACK"
        },
        {
          "locale": "ja-JP",
          "name": "VSTACK"
        },
        {
          "locale": "ko-KR",
          "name": "VSTACK"
        },
        {
          "locale": "lt-LT",
          "name": "VSTACK"
        },
        {
          "locale": "lv-LV",
          "name": "VSTACK"
        },
        {
          "locale": "nb-NO",
          "name": "VSTACK"
        },
        {
          "locale": "nl-NL",
          "name": "VERT.STAPELEN"
        },
        {
          "locale": "pl-PL",
          "name": "STOS.PION"
        },
        {
          "locale": "pt-BR",
          "name": "VSTACK"
        },
        {
          "locale": "pt-PT",
          "name": "JUNTARV"
        },
        {
          "locale": "ro-RO",
          "name": "VSTACK"
        },
        {
          "locale": "ru-RU",
          "name": "ВСТОЛБИК"
        },
        {
          "locale": "sk-SK",
          "name": "VSTACK"
        },
        {
          "locale": "sl-SI",
          "name": "VSTACK"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "VSTACK"
        },
        {
          "locale": "sv-SE",
          "name": "VSTACK"
        },
        {
          "locale": "th-TH",
          "name": "VSTACK"
        },
        {
          "locale": "tr-TR",
          "name": "DÜŞEYYIĞ"
        },
        {
          "locale": "uk-UA",
          "name": "VSTACK"
        },
        {
          "locale": "vi-VN",
          "name": "VSTACK"
        },
        {
          "locale": "zh-CN",
          "name": "VSTACK"
        },
        {
          "locale": "zh-HK",
          "name": "VSTACK"
        },
        {
          "locale": "zh-TW",
          "name": "VSTACK"
        }
      ],
      "signature": {
        "display": "VSTACK(array1, [array2], ...)",
        "parameters": [
          {
            "description": null,
            "name": "array1",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "array2",
            "optional": true,
            "repeats": true
          }
        ],
        "trailing_repeats": true
      },
      "surface_name": "VSTACK",
      "version_marker": null,
      "xlcall": null
    },
    "microsoft": "https://support.microsoft.com/en-us/office/vstack-function-a4b86897-be0f-48fc-adca-fcc10d795a9c"
  },
  "try_it": {
    "formula": "=VSTACK({1,2},{3,4})"
  },
  "url": "https://handbook.dnacalc.com/functions/VSTACK.html",
  "variants": [],
  "versions": []
}