{
  "category": "Compatibility",
  "display_name": "TTEST",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.TTEST",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Everything else matches (8 workbook cells). Last-bit means a finite number within 16 ULP of Excel's.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "close",
    "state_label": "Close: last-bit deviations remain",
    "summary": "Close: 2 of 8 recorded answers differ in the last bits, worst 2 ULP",
    "workbook_corpus": {
      "cells": 8,
      "last_bit": 2,
      "matched": 6,
      "worst_ulp": 2
    }
  },
  "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/distributions.rs#L345-L347"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/distributions::sample",
        "catalogue/distributions::whole",
        "catalogue/distributions::t_test_of",
        "ported/excel_numeric::binary_with",
        "ported/excel_numeric::excel_x87_add",
        "ported/excel_numeric::excel_x87_mul",
        "ported/excel_numeric::excel_x87_mul_add",
        "ported/excel_numeric/x87::mul",
        "ported/excel_numeric/x87::add",
        "ported/special_math_common::bratio_ftoi",
        "ported/special_math_common::bratio_spmpar1",
        "ported/special_math_common::bratio_exparg",
        "ported/special_math_common::bratio_esum",
        "ported/special_math_common::bratio_esum20",
        "ported/special_math_common::bratio_alnrel",
        "ported/special_math_common::bratio_rlog1",
        "ported/special_math_common::bratio_gam1",
        "ported/special_math_common::bratio_gamln1",
        "ported/special_math_common::bratio_gamln",
        "ported/special_math_common::bratio_algdiv",
        "ported/special_math_common::bratio_bcorr",
        "ported/special_math_common::bratio_gsumln",
        "ported/special_math_common::bratio_betaln",
        "ported/special_math_common::bratio_betaln_60",
        "ported/special_math_common::bratio_erf_nswc",
        "ported/special_math_common::bratio_erfc1",
        "ported/special_math_common::bratio_rexp",
        "ported/special_math_common::bratio_psi",
        "ported/special_math_common::bratio_fpser",
        "ported/special_math_common::bratio_apser",
        "ported/special_math_common::bratio_bpser",
        "ported/special_math_common::bratio_bup",
        "ported/special_math_common::bratio_brcomp",
        "ported/special_math_common::bratio_brcmp1",
        "ported/special_math_common::bratio_bfrac",
        "ported/special_math_common::bratio_bgrat",
        "ported/special_math_common::bratio_grat1",
        "ported/special_math_common::bratio_basym",
        "ported/special_math_common::bratio",
        "ported/statistical_tests_family::sample_mean",
        "ported/statistical_tests_family::sample_variance",
        "ported/statistical_tests_family::validate_positive_df",
        "ported/statistical_tests_family::t_probability",
        "ported/statistical_tests_family::t_test_paired_kernel",
        "ported/statistical_tests_family::t_test_equal_variance_kernel",
        "ported/statistical_tests_family::t_test_unequal_variance_kernel"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/distributions.rs#L345-L347",
      "state": "close",
      "suite": null,
      "summary": "Close: 2 of 8 recorded answers differ in the last bits, worst 2 ULP"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.TTEST.json",
  "name": "TTEST",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n[T.TEST](FUNC.T.TEST.md) is the modern spelling; [TDIST](FUNC.TDIST.md) accepts a supplied t statistic; [F.TEST](FUNC.F.TEST.md) compares variances.\n\n\n",
    "how-to-implement": "\nCollect numeric observations, retaining aligned pairs for type one. Let `mean`, `s²` and n denote each sample’s arithmetic mean, sample variance and count. The current test helpers use forward binary64 means and centered squared-deviation sums; they do not call the separately recovered VAR.S computation tree.\n\n| Type | Standard error SE | Degrees v |\n|---|---|---|\n| 1, paired differences d | `sqrt(s_d²/n)` | `n-1` |\n| 2, pooled | `sqrt(s_p²*(1/n1+1/n2))`, with `s_p²=((n1-1)*s1²+(n2-1)*s2²)/(n1+n2-2)` | `n1+n2-2` |\n| 3, unequal variances | `sqrt(a+b)`, with `a=s1²/n1,b=s2²/n2` | `(a+b)²/(a²/(n1-1)+b²/(n2-1))` |\n\nFor paired data set `t=abs(mean(d)/SE)`; otherwise set `t=abs((mean1-mean2)/SE)`. Reject zero SE. Retain fractional v for type three.\n\nThe current inner tail forms `t2=t*t`, `den=v+t2`, then separately stores `z=v/den` and `w=t2/den`. Evaluate `bratio(v/2,0.5,z,w).first`. This is the two-tail probability; divide it by two for one tail. Its paired beta arguments are not formed by computing `w=1-z`.\n\nFor a worked unequal-variance case, samples `{1,2,3}` and `{2,4,6}` have means two and four, variances one and four, and counts three each. Then `a=1/3,b=4/3`, SE is about `1.2909944487`, t about `1.5491933385`, and v is `50/17`, about `2.9411764706`. This shows why rounding v to an integer is a different test. In the starter example the means are equal, so t is zero and the two-tail probability one.\n\nThese formulas specify the current composition and operation order. The beta-ratio approximation and remaining numerical discrepancies remain open; a mathematical t-test implementation alone does not identify Excel’s private program.\n\n\n",
    "quirks": "\nType and tail selectors are truncated. Invalid selectors give `#NUM!`; nonnumeric selectors give `#VALUE!`. A paired test needs matched data-point counts or gives `#N/A`. Two independent-sample tests may use different counts.\n\nTTEST forms a nonnegative statistic. Its one-tail result is the upper probability for that magnitude, so it is half the two-tail result; swapping the samples does not select a different directional hypothesis in this function. The output is not the probability that the population means are equal.\n\nThe current numerical helpers return `#DIV/0!` for too few admitted observations or zero standard error. Type three retains its fractional Welch degree count internally; passing that count through the public TDIST wrapper would truncate it and change the calculation.\n\n\n",
    "sources": "\n- [Microsoft: TTEST function](https://support.microsoft.com/en-us/excel/functions/ttest-function), opened 6 November 2026; syntax, documented argument rules and errors.\n- [DnaCalc implementation](https://github.com/DnaCalc/DnaCalc/blob/da3ecc4fb19a3a5529708c311d0e8f05688ac165/crates/calc-func/src/ported/statistical_tests_family.rs); implementation steps and the limits identified in the text.\n\n",
    "try-it": "\n`=TTEST({1,2,3},{0,2,4},2,3)` returns `1` under the current route: both means are two, giving t=0 with a positive standard error. One tail returns one half.\n\n\n",
    "version-differences": "\nNo same-input comparison between named Excel builds is recorded for this function here. The documented behaviour below is not a measurement of every Excel release.\n\n\n",
    "what-it-does": "\n`TTEST(array1,array2,tails,type)` returns a t-test probability for two samples. Type one is paired, two assumes equal variances, and three uses the unequal-variance model. Tails is one or two. This is the compatibility name.\n\n\n"
  },
  "signature": {
    "display": "TTEST(array1, array2, tails, type)",
    "parameters": [
      {
        "description": null,
        "name": "array1",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "array2",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "tails",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "type",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 4,
        "min": 4
      },
      "category": "Compatibility",
      "classification": {
        "arg_preparation_profile": "RefsVisibleInAdapter",
        "coercion_lift_profile": "Custom",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "RefOnly",
        "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": "Student's t-test probability (older form of T.TEST)",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the probability associated with a Student's t-test",
        "microsoft_url": "https://support.microsoft.com/en-us/office/ttest-function-1696ffc1-4811-40fd-9d13-a0eaad83c7ae"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "TTEST"
        },
        {
          "locale": "bg-BG",
          "name": "TTEST"
        },
        {
          "locale": "cs-CZ",
          "name": "TTEST"
        },
        {
          "locale": "da-DK",
          "name": "TTEST"
        },
        {
          "locale": "de-DE",
          "name": "TTEST"
        },
        {
          "locale": "el-GR",
          "name": "TTEST"
        },
        {
          "locale": "en-AU",
          "name": "TTEST"
        },
        {
          "locale": "en-GB",
          "name": "TTEST"
        },
        {
          "locale": "en-US",
          "name": "TTEST"
        },
        {
          "locale": "es-ES",
          "name": "PRUEBA.T"
        },
        {
          "locale": "et-EE",
          "name": "TTEST"
        },
        {
          "locale": "fi-FI",
          "name": "TTESTI"
        },
        {
          "locale": "fr-FR",
          "name": "TEST.STUDENT*"
        },
        {
          "locale": "he-IL",
          "name": "TTEST"
        },
        {
          "locale": "hr-HR",
          "name": "TTEST"
        },
        {
          "locale": "hu-HU",
          "name": "T.PRÓBA"
        },
        {
          "locale": "id-ID",
          "name": "TTEST"
        },
        {
          "locale": "it-IT",
          "name": "TTEST"
        },
        {
          "locale": "ja-JP",
          "name": "TTEST"
        },
        {
          "locale": "ko-KR",
          "name": "TTEST"
        },
        {
          "locale": "lt-LT",
          "name": "TTEST"
        },
        {
          "locale": "lv-LV",
          "name": "TTEST"
        },
        {
          "locale": "nb-NO",
          "name": "TTEST"
        },
        {
          "locale": "nl-NL",
          "name": "T.TOETS"
        },
        {
          "locale": "pl-PL",
          "name": "TEST.T"
        },
        {
          "locale": "pt-BR",
          "name": "TTEST"
        },
        {
          "locale": "pt-PT",
          "name": "TESTET"
        },
        {
          "locale": "ro-RO",
          "name": "TTEST"
        },
        {
          "locale": "ru-RU",
          "name": "ТТЕСТ"
        },
        {
          "locale": "sk-SK",
          "name": "TTEST"
        },
        {
          "locale": "sl-SI",
          "name": "TTEST"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "TTEST"
        },
        {
          "locale": "sv-SE",
          "name": "TTEST"
        },
        {
          "locale": "th-TH",
          "name": "TTEST"
        },
        {
          "locale": "tr-TR",
          "name": "TTEST"
        },
        {
          "locale": "uk-UA",
          "name": "TTEST"
        },
        {
          "locale": "vi-VN",
          "name": "TTEST"
        },
        {
          "locale": "zh-CN",
          "name": "TTEST"
        },
        {
          "locale": "zh-HK",
          "name": "TTEST"
        },
        {
          "locale": "zh-TW",
          "name": "TTEST"
        }
      ],
      "signature": {
        "display": "TTEST(array1, array2, tails, type)",
        "parameters": [
          {
            "description": null,
            "name": "array1",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "array2",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "tails",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "type",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "TTEST",
      "version_marker": null,
      "xlcall": {
        "code": "316",
        "symbol": "xlfTtest"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/ttest-function-1696ffc1-4811-40fd-9d13-a0eaad83c7ae"
  },
  "try_it": {
    "formula": "=TTEST({1,2,3},{0,2,4},2,3)"
  },
  "url": "https://handbook.dnacalc.com/functions/TTEST.html",
  "variants": [],
  "versions": []
}