{
  "category": "Text functions",
  "display_name": "BAHTTEXT",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.BAHTTEXT",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20430"
      ],
      "larger_numeric": 0,
      "last_bit": 0,
      "matched": 2592,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 2592,
      "unread": 0,
      "worst_ulp": 0
    },
    "detail": "Recorded: 2,592 in the answer bank and 3 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 2,595 recorded answers",
    "workbook_corpus": {
      "cells": 3,
      "matched": 3
    }
  },
  "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/text_format.rs#L928-L928",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/text_format.rs#L621-L646",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/text_format.rs#L648-L675"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "decimal::low32",
        "decimal::Natural::zero",
        "decimal::Natural::from_u64",
        "decimal::Natural::pow10",
        "decimal::Natural::normalize",
        "decimal::Natural::is_zero",
        "decimal::Natural::mul_add_small",
        "decimal::Natural::times_pow10",
        "decimal::Natural::times_pow5",
        "decimal::Natural::times_pow2",
        "decimal::ExactDecimal::read",
        "decimal::ExactDecimal::binary",
        "format::digits",
        "format::fifteen",
        "format::split",
        "number_text::decimal",
        "number_text::first_precision",
        "number_text::near_tie",
        "number_text::first_rounding",
        "number_text::rounded",
        "number_text::increment",
        "number_text::ascii"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/text_format.rs#L928-L928",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 2,595 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.BAHTTEXT.json",
  "name": "BAHTTEXT",
  "notes": [
    {
      "basis": "8 recorded readings.",
      "documentation": null,
      "evidence": [
        {
          "commit": "36ff603e690aca6e53930870c02fd5fa92a9004a",
          "locator": "recorded_bahttext_retains_the_sign_of_a_negative_amount",
          "note": "recorded readings pinned",
          "path": "apps/dna-onecalc/tests/acceptance.rs",
          "repository": "DnaCalc"
        }
      ],
      "functions": [
        "FUNC.BAHTTEXT"
      ],
      "inferred": null,
      "kind": "quirk",
      "note_id": "FN-BAHTTEXT-001",
      "open": [],
      "recorded_on": "2026-11-04",
      "repros": [
        {
          "call": "BAHTTEXT(-0.001)",
          "correct": null,
          "excel": {
            "bits": null,
            "display": "ลบศูนย์บาทถ้วน",
            "kind": "text"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "number",
              "value": {
                "bits": "0xbf50624dd2f1a9fc",
                "display": "-0.001",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H",
          "source": {
            "commit": "4d5320dfdc385354469b4d506153357bb932ab08",
            "locator": "line 1210, key BAHTTEXT|0xbf50624dd2f1a9fc",
            "note": null,
            "path": "cache/oracle-20430/build-20430/BAHTTEXT.jsonl.gz",
            "repository": "CalcFunc-Evidence"
          }
        },
        {
          "call": "BAHTTEXT(-0)",
          "correct": null,
          "excel": {
            "bits": null,
            "display": "ศูนย์บาทถ้วน",
            "kind": "text"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "number",
              "value": {
                "bits": "0x8000000000000000",
                "display": "-0",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H",
          "source": {
            "commit": "4d5320dfdc385354469b4d506153357bb932ab08",
            "locator": "line 1225, key BAHTTEXT|0x8000000000000000",
            "note": null,
            "path": "cache/oracle-20430/build-20430/BAHTTEXT.jsonl.gz",
            "repository": "CalcFunc-Evidence"
          }
        },
        {
          "call": "BAHTTEXT(-0.005)",
          "correct": null,
          "excel": {
            "bits": null,
            "display": "ลบหนึ่งสตางค์",
            "kind": "text"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "number",
              "value": {
                "bits": "0xbf747ae147ae147b",
                "display": "-0.005",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H",
          "source": {
            "commit": "4d5320dfdc385354469b4d506153357bb932ab08",
            "locator": "line 1212, key BAHTTEXT|0xbf747ae147ae147b",
            "note": null,
            "path": "cache/oracle-20430/build-20430/BAHTTEXT.jsonl.gz",
            "repository": "CalcFunc-Evidence"
          }
        }
      ],
      "schema": "efh.function-note/v1",
      "statement": "A negative amount that rounds to zero satang still gets the word for minus, ลบ: BAHTTEXT(-0.001) is ลบศูนย์บาทถ้วน. -0 gives plain ศูนย์บาทถ้วน.",
      "status": "measured",
      "title": "A tiny negative amount keeps the word for minus before zero baht"
    }
  ],
  "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- `TEXT` — the general number-formatting function, and the usual alternative when what you actually\n  wanted was a formatted numeral rather than words. `TEXT` cannot spell numbers out in any\n  language.\n- `DOLLAR` and `FIXED` — the other currency-adjacent text functions. Both format digits; neither\n  spells. `DOLLAR` is locale-sensitive in its symbol, which is a different kind of localisation\n  from `BAHTTEXT`'s fixed Thai output.\n- Readers sometimes expect `BAHTTEXT` to respect the workbook's currency locale. It does not; the\n  output is Thai regardless of where the workbook is opened.\n- Nothing supersedes `BAHTTEXT` and it supersedes nothing.\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n\n- **The spelling rules are the specification.** Thai numeral spelling is not digit-by-digit: the\n  unit-place \"one\" has a distinct form, \"twenty\" has a distinct form for the tens digit, and the\n  grouping above a million repeats a scale word rather than introducing new ones. Get these from a\n  Thai orthography reference, not from a transliteration table.\n- **Fix the rounding rule and record it.** Rounding to two decimals is the only arithmetic in the\n  function and it is where any divergence will live. Do the rounding on the decimal value the user\n  sees, and be explicit about half-way cases.\n- **The trailing \"exactly\" is conditional on the satang being zero after rounding**, not before.\n  `BAHTTEXT(1.001)` and `BAHTTEXT(1)` should agree if rounding takes the first to one baht exactly.\n- **Emit the Thai script directly as Unicode**, not through a legacy Thai code page. The result is\n  worksheet text, which is UTF-16.\n- **Validate the domain before spelling**, so that an oversized input produces `#NUM!` rather than\n  a partially built string. A negative input is spelled, not rejected (FN-BAHTTEXT-001).\n- **Do not localise the output.** It is Thai on every installation; making it follow the UI language\n  would be a divergence, not an improvement.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nThe return kind is `Text`, in Thai script.\n\n- **Negative numbers.** Upstream's contract records the current baseline as rejecting negative\n  magnitudes with `#NUM!`. Excel does not reject them: it spells a negative amount with the word\n  for minus, ลบ, so `BAHTTEXT(-0.005)` is `ลบหนึ่งสตางค์` (FN-BAHTTEXT-001).\n- **Very large magnitudes** are likewise recorded upstream as rejected with `#NUM!`. Where the\n  boundary sits — and whether it is a magnitude limit, a digit-count limit, or the point at which a\n  double stops representing integers exactly — is not established here.\n- **Rounding is observable at the boundary.** A value ending in exactly half a satang\n  (`1.005`, `2.675`) will expose the rounding rule, and will also expose the fact that such values\n  are not exactly representable as doubles in the first place. This is the one place where\n  `BAHTTEXT` has a genuine floating-point subtlety, and it is inherited from the argument, not\n  created by the function.\n- **Zero** produces the zero-baht form with the \"exactly\" tail.\n- **Errors propagate**; an empty referenced cell delivers `Empty`, distinct from an omitted\n  argument (see [the value universe](../model/01-value-universe.md)).\n- **Array arguments.** Whether `BAHTTEXT` lifts elementwise is not asserted here; the general rules\n  are in [coercion and lifting](../model/02-coercion-and-lifting.md).\n\n\n\n### Errors\n\n\nMicrosoft's page is the authority and is linked below; it was not retrievable while this entry was\nwritten, so this section states expectations and upstream readings rather than quoting it.\n\n",
    "sources": "- Microsoft Support, BAHTTEXT function —\n  <https://support.microsoft.com/en-us/office/bahttext-function-5ba4d0b4-abd3-4325-8d22-7a92d59aab9c>\n  (the authority for signature and documented description; not retrievable while this entry was\n  written, so it is cited by reference and nothing here paraphrases it).\n- Handbook `content/model/01-value-universe.md` (the `Number` and `Text` kinds, Empty versus\n  Missing), `02-coercion-and-lifting.md` (to-number coercion, error propagation).\n\n",
    "version-differences": "The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.\n\n| Excel 16.0 build | Platform and CPU | Captured inputs |\n|---|---|---:|\n| 20430 | Windows, 64-bit, AMD Ryzen 7 4800H with Radeon Graphics | 1,983 |\n\nThe record contains no same-input comparison between these environments. Reading different inputs on different builds does not establish either a version change or cross-build agreement.\n\n[Recorded environments and comparison details](https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.BAHTTEXT.json).",
    "what-it-does": "\n`BAHTTEXT` spells a number out in Thai words as an amount of currency, appending the Thai word for\nbaht — and, when there is a fractional part, the satang.\n\nIt is worth being clear about how unusual this is. `BAHTTEXT` is the only function in the ordinary\nworksheet surface that performs **number-to-words conversion in a natural language**. There is no\n`ENGLISHTEXT`; the equivalent in every other language is a user-defined function or a long nested\nformula. Its presence in the catalogue is a historical artefact of Excel's Thai localisation, and\nit is available regardless of the installation's language — the output is always Thai script.\n\nThe computation has three stages:\n\n2. **Spell the integer part** using Thai numeral words, then append the word for baht. Thai numeral\n   spelling has its own irregularities — notably the special forms used for \"one\" in the units\n   place and for \"twenty\" — which is what makes this a table-and-rules problem rather than a digit\n   substitution.\n3. **Spell the fractional part** in satang and append the satang word; when the fraction is zero,\n   append instead the Thai word meaning \"exactly\" or \"whole\" (ถ้วน), which is the conventional way\n   to close a written currency amount and to prevent a figure being altered after the fact.\n\nThat last convention is why the zero case and the non-zero case produce structurally different\nstrings rather than one with an empty tail.\n\n\n\n### Arguments\n\n\n`BAHTTEXT(number)`\n\n| Argument | Required | Meaning |\n|---|---|---|\n| `number` | yes | The number to convert to Thai baht text. |\n\nOne argument. It is a *number*, so text that reads as a number converts and `TRUE` converts to `1`\nunder the general to-number rule in [coercion and lifting](../model/02-coercion-and-lifting.md).\n\nThere is no argument controlling the script, the currency word, or whether the trailing \"exactly\"\nappears. There is no way to get the words without the currency.\n\n\n"
  },
  "signature": {
    "display": "BAHTTEXT(number)",
    "parameters": [
      {
        "description": null,
        "name": "number",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 1,
        "min": 1
      },
      "category": "Text 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": "A number spelled out in Thai words as an amount in baht",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Converts a number to text, using the ? (baht) currency format",
        "microsoft_url": "https://support.microsoft.com/en-us/office/bahttext-function-5ba4d0b4-abd3-4325-8d22-7a92d59aab9c"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "BAHTTEXT"
        },
        {
          "locale": "bg-BG",
          "name": "BAHTTEXT"
        },
        {
          "locale": "cs-CZ",
          "name": "BAHTTEXT"
        },
        {
          "locale": "da-DK",
          "name": "BAHTTEKST"
        },
        {
          "locale": "de-DE",
          "name": "BAHTTEXT"
        },
        {
          "locale": "el-GR",
          "name": "BAHTTEXT"
        },
        {
          "locale": "en-AU",
          "name": "BAHTTEXT"
        },
        {
          "locale": "en-GB",
          "name": "BAHTTEXT"
        },
        {
          "locale": "en-US",
          "name": "BAHTTEXT"
        },
        {
          "locale": "es-ES",
          "name": "TEXTOBAHT"
        },
        {
          "locale": "et-EE",
          "name": "BAHTTEXT"
        },
        {
          "locale": "fi-FI",
          "name": "BAHTTEKSTI"
        },
        {
          "locale": "fr-FR",
          "name": "BAHTTEXT*"
        },
        {
          "locale": "he-IL",
          "name": "BAHTTEXT"
        },
        {
          "locale": "hr-HR",
          "name": "BAHTTEXT"
        },
        {
          "locale": "hu-HU",
          "name": "BAHTSZÖVEG"
        },
        {
          "locale": "id-ID",
          "name": "BAHTTEXT"
        },
        {
          "locale": "it-IT",
          "name": "BAHTTEXT"
        },
        {
          "locale": "ja-JP",
          "name": "BAHTTEXT"
        },
        {
          "locale": "ko-KR",
          "name": "BAHTTEXT"
        },
        {
          "locale": "lt-LT",
          "name": "BAHTTEXT"
        },
        {
          "locale": "lv-LV",
          "name": "BAHTTEXT"
        },
        {
          "locale": "nb-NO",
          "name": "BAHTTEXT"
        },
        {
          "locale": "nl-NL",
          "name": "BAHTTEXT"
        },
        {
          "locale": "pl-PL",
          "name": "BAT.TEKST"
        },
        {
          "locale": "pt-BR",
          "name": "BAHTTEXT"
        },
        {
          "locale": "pt-PT",
          "name": "TEXTO.BAHT"
        },
        {
          "locale": "ro-RO",
          "name": "BAHTTEXT"
        },
        {
          "locale": "ru-RU",
          "name": "БАТТЕКСТ"
        },
        {
          "locale": "sk-SK",
          "name": "BAHTTEXT"
        },
        {
          "locale": "sl-SI",
          "name": "BAHTTEXT"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "BAHTTEXT"
        },
        {
          "locale": "sv-SE",
          "name": "BAHTTEXT"
        },
        {
          "locale": "th-TH",
          "name": "BAHTTEXT"
        },
        {
          "locale": "tr-TR",
          "name": "BAHTMETİN işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "BAHTTEXT"
        },
        {
          "locale": "vi-VN",
          "name": "BAHTTEXT"
        },
        {
          "locale": "zh-CN",
          "name": "BAHTTEXT"
        },
        {
          "locale": "zh-HK",
          "name": "BAHTTEXT"
        },
        {
          "locale": "zh-TW",
          "name": "BAHTTEXT"
        }
      ],
      "signature": {
        "display": "BAHTTEXT(number)",
        "parameters": [
          {
            "description": null,
            "name": "number",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "BAHTTEXT",
      "version_marker": null,
      "xlcall": {
        "code": "368",
        "symbol": "xlfBahttext"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/bahttext-function-5ba4d0b4-abd3-4325-8d22-7a92d59aab9c"
  },
  "try_it": {
    "formula": "=BAHTTEXT(-0.005)"
  },
  "url": "https://handbook.dnacalc.com/functions/BAHTTEXT.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "BAHTTEXT(-0.001) returned ลบศูนย์บาทถ้วน. BAHTTEXT(-0) returned ศูนย์บาทถ้วน. 1 further recorded control is attached. Inputs were supplied through cells using Value2. These are controls from this environment, not a same-input comparison with another build.",
      "excel_build": "16.0 build 20430",
      "observations": [
        {
          "call": "BAHTTEXT(-0.001)",
          "excel": {
            "bits": null,
            "display": "ลบศูนย์บาทถ้วน",
            "kind": "text"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "number",
              "value": {
                "bits": "0xbf50624dd2f1a9fc",
                "display": "-0.001",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H"
        },
        {
          "call": "BAHTTEXT(-0)",
          "excel": {
            "bits": null,
            "display": "ศูนย์บาทถ้วน",
            "kind": "text"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "number",
              "value": {
                "bits": "0x8000000000000000",
                "display": "-0",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H"
        },
        {
          "call": "BAHTTEXT(-0.005)",
          "excel": {
            "bits": null,
            "display": "ลบหนึ่งสตางค์",
            "kind": "text"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "number",
              "value": {
                "bits": "0xbf747ae147ae147b",
                "display": "-0.005",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H"
        }
      ],
      "platform": "Windows 64-bit, AMD Ryzen 7 4800H",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/3345a87/content/notes/FN-BAHTTEXT-001.json"
      ]
    },
    {
      "behaviour": "1,983 captured inputs are indexed for this environment. Capture dates: 2026-09-24 to 2026-09-25. This is a reading count, not a comparison with another build.",
      "excel_build": "16.0 build 20430",
      "platform": "Windows, 64-bit, AMD Ryzen 7 4800H with Radeon Graphics",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.BAHTTEXT.json"
      ]
    }
  ]
}