{
  "category": "Lookup and reference functions",
  "display_name": "TRANSPOSE",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.TRANSPOSE",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Recorded: 7 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 7 recorded answers",
    "workbook_corpus": {
      "cells": 8,
      "matched": 7,
      "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/host_facts.rs#L456-L456",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/host_facts.rs#L418-L443"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/host_facts.rs#L456-L456",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 7 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.TRANSPOSE.json",
  "name": "TRANSPOSE",
  "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- **`TOCOL` / `TOROW`** flatten rather than transpose; the pair are related by\n  `TOROW(x, i, s) = TRANSPOSE(TOCOL(x, i, s))`, which makes `TRANSPOSE` the bridge between the\n  two flattening directions.\n- **`VSTACK` / `HSTACK`** are similarly related through transposition:\n  `HSTACK(a, b) = TRANSPOSE(VSTACK(TRANSPOSE(a), TRANSPOSE(b)))`.\n- **`MMULT`, `MINVERSE`, `MDETERM`** are the rest of the matrix family; `TRANSPOSE` is the one\n  member that is pure index arithmetic with no floating-point content, and therefore the one\n  member with no accuracy question at all.\n- **Paste Special ▸ Transpose** is the destructive command form: it writes values, does not\n  recompute, and is what `TRANSPOSE` replaces for live data.\n- **`WRAPROWS` / `WRAPCOLS`** reshape rather than reflect; a reader wanting `m × n` from `n × m`\n  data in a *different* element order wants those, not this.\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n- The operation is index arithmetic and nothing else. Any implementation that copies values\n  through a coercion step is doing more than the function asks and can only introduce\n  divergence.\n- Row-major storage makes transposition a strided copy; for large arrays the cache behaviour\n  differs sharply between the naive and the blocked implementation, but the result must not.\n- `TRANSPOSE` is an excellent *test instrument* for other functions precisely because it is\n  exact and self-inverse: `TRANSPOSE(TRANSPOSE(f(x))) = f(x)` is a metamorphic check that needs\n  no oracle.\n- Blank handling should follow the engine's general empty-cell rule rather than acquiring a\n  local convention.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nThe return kind is an array with the input's dimensions exchanged.\n\n- **Values are moved, not interpreted.** Errors, text, logicals and blanks all survive\n  transposition unchanged. `TRANSPOSE` does not coerce.\n- **What happens to blanks** is the one genuine question. A blank cell in a range has no value\n  of its own, and the general model says `Empty` is admitted at the raw-return boundary but not\n  at the published-result boundary, normalizing to zero on the way out\n  ([the value universe](../model/01-value-universe.md)). A transposed blank cell that publishes\n  as `0` is therefore expected behaviour under the shared model rather than a `TRANSPOSE`\n  quirk — but the Handbook has not verified it for this function.\n- **A 1×1 input** transposes to a 1×1 array, and must remain array-shaped.\n- **A single-row or single-column input** is the common case and exercises none of the\n  interesting index arithmetic; a rectangular input does.\n- **Very large arrays** hit the grid limits at publication.\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\nMicrosoft's page for `TRANSPOSE` does not enumerate error conditions, which is consistent with\na total function on arrays: every rectangular array has a transpose.\n\nThe errors a reader meets in practice come from elsewhere — `#SPILL!` when the swapped\ndimensions do not fit, `#VALUE!` on a legacy grid when an array result was not array-entered,\nand whatever error values were already inside the array and are simply carried across.\n\n\n",
    "sources": "- Microsoft, *TRANSPOSE function* —\n  <https://support.microsoft.com/en-us/office/transpose-function-ed039415-ed8a-4a81-93e9-4b6dfac76027>\n  (syntax and the axis-exchange 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` (the `Empty` kind and the raw-return versus\n  published-result boundary) and `content/model/03-call-pipeline.md`.\n- Handbook `data/functions/FUNC.TRANSPOSE.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`TRANSPOSE` exchanges an array's axes. For an `m × n` input `A`, the result `B` is `n × m`\nwith\n\n    B[j, i] = A[i, j]     for all i ∈ 1..m, j ∈ 1..n\n\nThat is the complete definition, and it is one of the very few worksheet functions whose\nmathematics is exactly the mathematics of the same-named operation in linear algebra. A row\nbecomes a column, a column becomes a row, and a rectangle turns on its side. No values change,\nnone are added or removed, and the operation is its own inverse:\n`TRANSPOSE(TRANSPOSE(A)) = A`.\n\nThe historical importance of `TRANSPOSE` is out of proportion to its simplicity. Before dynamic\narrays it was one of the very few functions whose *natural* result was an array, which made it\nthe standard teaching example for Ctrl+Shift+Enter array entry — you had to select the target\nrectangle first, with the dimensions swapped, before committing the formula. On a modern Excel\nit simply spills, and that entire ritual is gone.\n\n\n\n### Arguments\n\n\n`TRANSPOSE(array)` — exactly one argument, required, no options.\n\n**`array`** — the range or array to transpose. A reference is admissible and is resolved to its\nvalues; unlike `OFFSET` or `ROW`, `TRANSPOSE` has no interest in the address.\n\nThe only thing regularly misunderstood about the argument is what comes back: readers who pass\na single column expect a single column with a different orientation on screen, which is exactly\nwhat they get, and readers who pass a rectangle sometimes expect a rotation rather than a\ntransposition. Transposition is a reflection across the main diagonal, not a 90-degree\nrotation: the top-left element stays put, and the anti-diagonal order is not reversed.\n\n\n"
  },
  "signature": {
    "display": "TRANSPOSE(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": "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": "An array with rows and columns swapped",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the transpose of an array",
        "microsoft_url": "https://support.microsoft.com/en-us/office/transpose-function-ed039415-ed8a-4a81-93e9-4b6dfac76027"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "TRANSPOSE"
        },
        {
          "locale": "bg-BG",
          "name": "TRANSPOSE"
        },
        {
          "locale": "cs-CZ",
          "name": "TRANSPOZICE"
        },
        {
          "locale": "da-DK",
          "name": "TRANSPONER"
        },
        {
          "locale": "de-DE",
          "name": "MTRANS"
        },
        {
          "locale": "el-GR",
          "name": "TRANSPOSE"
        },
        {
          "locale": "en-AU",
          "name": "TRANSPOSE"
        },
        {
          "locale": "en-GB",
          "name": "TRANSPOSE"
        },
        {
          "locale": "en-US",
          "name": "TRANSPOSE"
        },
        {
          "locale": "es-ES",
          "name": "TRANSPONER"
        },
        {
          "locale": "et-EE",
          "name": "TRANSPOSE"
        },
        {
          "locale": "fi-FI",
          "name": "TRANSPONOI"
        },
        {
          "locale": "fr-FR",
          "name": "TRANSPOSE"
        },
        {
          "locale": "he-IL",
          "name": "TRANSPOSE"
        },
        {
          "locale": "hr-HR",
          "name": "TRANSPOSE"
        },
        {
          "locale": "hu-HU",
          "name": "TRANSZPONÁLÁS"
        },
        {
          "locale": "id-ID",
          "name": "TRANSPOSE"
        },
        {
          "locale": "it-IT",
          "name": "TRASPONI"
        },
        {
          "locale": "ja-JP",
          "name": "TRANSPOSE"
        },
        {
          "locale": "ko-KR",
          "name": "TRANSPOSE"
        },
        {
          "locale": "lt-LT",
          "name": "TRANSPOSE"
        },
        {
          "locale": "lv-LV",
          "name": "TRANSPOSE"
        },
        {
          "locale": "nb-NO",
          "name": "TRANSPONER"
        },
        {
          "locale": "nl-NL",
          "name": "TRANSPONEREN"
        },
        {
          "locale": "pl-PL",
          "name": "TRANSPONUJ"
        },
        {
          "locale": "pt-BR",
          "name": "TRANSPOR"
        },
        {
          "locale": "pt-PT",
          "name": "TRANSPOR"
        },
        {
          "locale": "ro-RO",
          "name": "TRANSPOSE"
        },
        {
          "locale": "ru-RU",
          "name": "ТРАНСП"
        },
        {
          "locale": "sk-SK",
          "name": "TRANSPOSE"
        },
        {
          "locale": "sl-SI",
          "name": "TRANSPOSE"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "TRANSPOSE"
        },
        {
          "locale": "sv-SE",
          "name": "TRANSPONERA"
        },
        {
          "locale": "th-TH",
          "name": "TRANSPOSE"
        },
        {
          "locale": "tr-TR",
          "name": "DEVRİK_DÖNÜŞÜM"
        },
        {
          "locale": "uk-UA",
          "name": "TRANSPOSE"
        },
        {
          "locale": "vi-VN",
          "name": "Hàm TRANSPOSE"
        },
        {
          "locale": "zh-CN",
          "name": "TRANSPOSE"
        },
        {
          "locale": "zh-HK",
          "name": "TRANSPOSE"
        },
        {
          "locale": "zh-TW",
          "name": "TRANSPOSE"
        }
      ],
      "signature": {
        "display": "TRANSPOSE(array)",
        "parameters": [
          {
            "description": null,
            "name": "array",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "TRANSPOSE",
      "version_marker": null,
      "xlcall": {
        "code": "83",
        "symbol": "xlfTranspose"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/transpose-function-ed039415-ed8a-4a81-93e9-4b6dfac76027"
  },
  "try_it": {
    "formula": "=TRANSPOSE({1,2;3,4})"
  },
  "url": "https://handbook.dnacalc.com/functions/TRANSPOSE.html",
  "variants": [],
  "versions": []
}