{
  "category": "Lookup and reference functions",
  "display_name": "TOROW",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.TOROW",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Recorded: 9 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 9 recorded answers",
    "workbook_corpus": {
      "cells": 9,
      "matched": 9
    }
  },
  "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#L690-L696",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/dynamic_array_reshape_family.rs#L497-L513"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/arrays::source_error",
        "catalogue/arrays::prepared",
        "catalogue/arrays::prepared_one",
        "catalogue/arrays::by_area",
        "catalogue/arrays::result",
        "catalogue/arrays::run",
        "catalogue/arrays::as_array",
        "ported/dynamic_array_reshape_family::coerce_prepared_to_number",
        "ported/dynamic_array_reshape_family::scalar_cell",
        "ported/dynamic_array_reshape_family::materialize_array_arg",
        "ported/dynamic_array_reshape_family::shape",
        "ported/dynamic_array_reshape_family::get",
        "ported/dynamic_array_reshape_family::parse_integer",
        "ported/dynamic_array_reshape_family::parse_bool_like",
        "ported/dynamic_array_reshape_family::build_array",
        "ported/dynamic_array_reshape_family::flatten_cells",
        "ported/dynamic_array_reshape_family::should_ignore_cell",
        "ported/dynamic_array_reshape_family::parse_ignore_mode",
        "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#L690-L696",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 9 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.TOROW.json",
  "name": "TOROW",
  "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- **`TOCOL`** is the transpose twin, with the identical argument vocabulary.\n- **`WRAPROWS` / `WRAPCOLS`** invert the flattening: a vector back to a rectangle. `WRAPROWS`\n  is the natural partner of `TOROW` when reshaping `m × n` to `p × q`.\n- **`TRANSPOSE`** exchanges axes without flattening.\n- **`HSTACK`** builds a row by concatenation rather than by flattening; for single-row inputs\n  the two coincide, and for rectangular inputs they do not.\n- **`TEXTJOIN(delim, TRUE, TOROW(range, 1))`** is the idiomatic \"list these values in a\n  sentence\" composition.\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n- The output axis and the traversal axis are independent. Writing `TOROW` as \"transpose, then\n  `TOCOL`\" is correct but changes which traversal flag means what — the composition has to be\n  worked out rather than assumed.\n- `ignore` is a code with four admitted values; anything else needs a decided outcome.\n- The blank definition must be stated explicitly and shared with `TOCOL`.\n- Filtering must preserve traversal order.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nThe return kind is a single-row array.\n\n- **The result can be empty** when `ignore` removes everything; Excel's convention for an empty\n  array result is `#CALC!` ([the value universe](../model/01-value-universe.md)), and `TOROW`\n  uses it with `ignore` `2` when nothing is left (FN-HSTACK-001).\n- **\"Blank\" is ambiguous** between an empty cell and text of zero length. Which one `ignore`\n  `1` drops is the question that decides how the function behaves on formula-generated data,\n  and the documentation does not disambiguate it.\n- **Ignoring errors shortens the result**; positions no longer correspond to source cells. A\n  direct error is not an element and is not ignored (FN-HSTACK-001).\n- **A one-element result stays an array.**\n- Dynamic-array publication and `#SPILL!` are host-side adaptation.\n\n\n\n### Errors\n\n\nMicrosoft's `TOCOL` page documents `#VALUE!` for an array constant containing numbers that are\nnot whole numbers, and `#NUM!` for an array that is too large. `TOROW` is documented as the\ntwin function and the same conditions are the expected ones; the Handbook has not confirmed\nthat the `TOROW` page states them identically, and does not assert the first condition's\nmeaning, which does not obviously describe a flattening operation.\n\n\n",
    "sources": "\n- Microsoft, *TOROW function* —\n  <https://support.microsoft.com/en-us/office/torow-function-b90d0964-a7d9-44b7-816b-ffa5c2fe2289>\n  (syntax and argument meanings). Not retrieved for this page; the behaviour above is stated as\n  documented behaviour and should be re-checked against the page.\n- Microsoft, *TOCOL function* —\n  <https://support.microsoft.com/en-us/office/tocol-function-22839d9b-0b55-4fc1-b4e6-2761f8f122ed>\n  (the shared `ignore` value table, the `scan_by_column` default, and the documented `#VALUE!`\n  and `#NUM!` conditions). Retrieved for this page and used as the twin function's reference.\n- Handbook `content/model/01-value-universe.md` and `content/model/03-call-pipeline.md`.\n- Handbook `data/functions/FUNC.TOROW.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`TOROW` flattens an `m × n` array into a **single row**.\n\nThe elements are visited in one of two traversal orders and, optionally, filtered by kind\nbefore being laid out left to right:\n\n- **`scan_by_column` omitted or `FALSE`** — scan by row: row 1 left to right, then row 2, and\n  so on (row-major).\n- **`scan_by_column` `TRUE`** — scan by column: column 1 top to bottom, then column 2\n  (column-major).\n\nFor `{1,2;3,4}` those give `{1,2,3,4}` and `{1,3,2,4}`.\n\nThe `ignore` argument drops element kinds before assembly, with the same code vocabulary the\nwhole flattening pair shares: `0` keep everything (default), `1` ignore blanks, `2` ignore\nerrors, `3` ignore both.\n\n`TOROW` and `TOCOL` are the same operation with the output axis exchanged;\n`TOROW(x, i, s)` equals `TRANSPOSE(TOCOL(x, i, s))`. Which one you want is decided by what\nconsumes the result, not by anything about the input.\n\n\n\n### Arguments\n\n\nMicrosoft documents `TOROW(array, [ignore], [scan_by_column])`.\n\n**`array`** — required. The array or reference to flatten.\n\n**`ignore`** — optional, default `0`. Values `0`–`3` as above. It is an integer code, not a\nlogical, even though `1` and `TRUE` coerce alike.\n\n**`scan_by_column`** — optional, default `FALSE`. A logical selecting the traversal order.\n\nThe common confusion is between the two optional positions: `TOROW(A, 1)` filters blanks;\n`TOROW(A, , 1)` changes the traversal. Both are legal and neither errors, so the mistake shows\nup as a silently reordered or silently shortened row.\n\nA second confusion is specific to this function's name. `TOROW` does **not** mean \"read the\narray by rows\" — that is `scan_by_column` `FALSE`. It means \"produce a row\". The name describes\nthe output shape; the traversal is the third argument's business.\n\n\n"
  },
  "signature": {
    "display": "TOROW(array, [ignore], [scan_by_column])",
    "parameters": [
      {
        "description": null,
        "name": "array",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "ignore",
        "optional": true,
        "repeats": false
      },
      {
        "description": null,
        "name": "scan_by_column",
        "optional": true,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 3,
        "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": "The items of an array in one row",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the array in a single row",
        "microsoft_url": "https://support.microsoft.com/en-us/office/torow-function-b90d0964-a7d9-44b7-816b-ffa5c2fe2289"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "TOROW"
        },
        {
          "locale": "bg-BG",
          "name": "TOROW"
        },
        {
          "locale": "cs-CZ",
          "name": "DO.ŘÁDKU"
        },
        {
          "locale": "da-DK",
          "name": "TILRÆKKE"
        },
        {
          "locale": "de-DE",
          "name": "TOROW"
        },
        {
          "locale": "el-GR",
          "name": "TOROW"
        },
        {
          "locale": "en-AU",
          "name": "TOROW"
        },
        {
          "locale": "en-GB",
          "name": "TOROW"
        },
        {
          "locale": "en-US",
          "name": "TOROW"
        },
        {
          "locale": "es-ES",
          "name": "ENFILA"
        },
        {
          "locale": "et-EE",
          "name": "TOROW"
        },
        {
          "locale": "fi-FI",
          "name": "RIVIIN"
        },
        {
          "locale": "fr-FR",
          "name": "DANSLIGNE*"
        },
        {
          "locale": "he-IL",
          "name": "TOROW"
        },
        {
          "locale": "hr-HR",
          "name": "TOROW"
        },
        {
          "locale": "hu-HU",
          "name": "SORHOZ"
        },
        {
          "locale": "id-ID",
          "name": "TOROW"
        },
        {
          "locale": "it-IT",
          "name": "TOROW"
        },
        {
          "locale": "ja-JP",
          "name": "TOROW"
        },
        {
          "locale": "ko-KR",
          "name": "TOROW"
        },
        {
          "locale": "lt-LT",
          "name": "TOROW"
        },
        {
          "locale": "lv-LV",
          "name": "TOROW"
        },
        {
          "locale": "nb-NO",
          "name": "TOROW"
        },
        {
          "locale": "nl-NL",
          "name": "NAAR.RIJ"
        },
        {
          "locale": "pl-PL",
          "name": "DO.WIERSZA"
        },
        {
          "locale": "pt-BR",
          "name": "TOROW"
        },
        {
          "locale": "pt-PT",
          "name": "PARALIN"
        },
        {
          "locale": "ro-RO",
          "name": "TOROW"
        },
        {
          "locale": "ru-RU",
          "name": "ПОСТРОК"
        },
        {
          "locale": "sk-SK",
          "name": "TOROW"
        },
        {
          "locale": "sl-SI",
          "name": "TOROW"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "TOROW"
        },
        {
          "locale": "sv-SE",
          "name": "TILLRAD"
        },
        {
          "locale": "th-TH",
          "name": "TOROW"
        },
        {
          "locale": "tr-TR",
          "name": "SATIRA"
        },
        {
          "locale": "uk-UA",
          "name": "TOROW"
        },
        {
          "locale": "vi-VN",
          "name": "TOROW"
        },
        {
          "locale": "zh-CN",
          "name": "TOROW"
        },
        {
          "locale": "zh-HK",
          "name": "TOROW"
        },
        {
          "locale": "zh-TW",
          "name": "TOROW"
        }
      ],
      "signature": {
        "display": "TOROW(array, [ignore], [scan_by_column])",
        "parameters": [
          {
            "description": null,
            "name": "array",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "ignore",
            "optional": true,
            "repeats": false
          },
          {
            "description": null,
            "name": "scan_by_column",
            "optional": true,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "TOROW",
      "version_marker": null,
      "xlcall": null
    },
    "microsoft": "https://support.microsoft.com/en-us/office/torow-function-b90d0964-a7d9-44b7-816b-ffa5c2fe2289"
  },
  "try_it": {
    "formula": "=TOROW({1,2;3,4})"
  },
  "url": "https://handbook.dnacalc.com/functions/TOROW.html",
  "variants": [],
  "versions": []
}