Compatibility
TTEST
Close: 2 of 8 recorded answers differ in the last bits, worst 2 ULP
Everything else matches (8 workbook cells). Last-bit means a finite number within 16 ULP of Excel's. How we measure this · See the Rust code
Local names in 40 languages
| Language | Name in Excel |
|---|---|
| Arabic | TTEST |
| Bulgarian | TTEST |
| Czech | TTEST |
| Danish | TTEST |
| German | TTEST |
| Greek | TTEST |
| English (Australia) | TTEST |
| English (United Kingdom) | TTEST |
| English (United States) | TTEST |
| Spanish | PRUEBA.T |
| Estonian | TTEST |
| Finnish | TTESTI |
| French | TEST.STUDENT |
| Hebrew | TTEST |
| Croatian | TTEST |
| Hungarian | T.PRÓBA |
| Indonesian | TTEST |
| Italian | TTEST |
| Japanese | TTEST |
| Korean | TTEST |
| Lithuanian | TTEST |
| Latvian | TTEST |
| Norwegian | TTEST |
| Dutch | T.TOETS |
| Polish | TEST.T |
| Portuguese (Brazil) | TTEST |
| Portuguese (Portugal) | TESTET |
| Romanian | TTEST |
| Russian | ТТЕСТ |
| Slovak | TTEST |
| Slovenian | TTEST |
| Serbian (Latin) | TTEST |
| Swedish | TTEST |
| Thai | TTEST |
| Turkish | TTEST |
| Ukrainian | TTEST |
| Vietnamese | TTEST |
| Chinese (Simplified) | TTEST |
| Chinese (Hong Kong) | TTEST |
| Chinese (Traditional) | TTEST |
Names from Microsoft's support site.
What it does
TTEST(array1, array2, tails, type)
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.
Try it
=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.
Quirks
Type 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.
TTEST 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.
The 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.
How to implement
Collect 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.
| Type | Standard error SE | Degrees v |
|---|---|---|
| 1, paired differences d | sqrt(s_d²/n) | n-1 |
| 2, pooled | sqrt(s_p²*(1/n1+1/n2)), with s_p²=((n1-1)*s1²+(n2-1)*s2²)/(n1+n2-2) | n1+n2-2 |
| 3, unequal variances | sqrt(a+b), with a=s1²/n1,b=s2²/n2 | (a+b)²/(a²/(n1-1)+b²/(n2-1)) |
For paired data set t=abs(mean(d)/SE); otherwise set t=abs((mean1-mean2)/SE). Reject zero SE. Retain fractional v for type three.
The 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.
For 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.
These 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.
Rust code
Show the CalcFunc source of this function
Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.
TTEST · 3 lines · calc-func/src/catalogue/distributions.rs on GitHub105 ttest "TTEST" (4, 4) [R "array1", R "array2", V "tails", V "type"] |s, a, sv| {
t_test_of(s, a, sv)
}
Kernels shared with other functions
samplecatalogue/distributionswholecatalogue/distributionst_test_ofcatalogue/distributionsbinary_withported/excel_numericexcel_x87_addported/excel_numericexcel_x87_mulported/excel_numericexcel_x87_mul_addported/excel_numericmulported/excel_numeric/x87addported/excel_numeric/x87bratio_ftoiported/special_math_commonbratio_spmpar1ported/special_math_commonbratio_expargported/special_math_commonbratio_esumported/special_math_commonbratio_esum20ported/special_math_commonbratio_alnrelported/special_math_commonbratio_rlog1ported/special_math_commonbratio_gam1ported/special_math_commonbratio_gamln1ported/special_math_commonbratio_gamlnported/special_math_commonbratio_algdivported/special_math_commonbratio_bcorrported/special_math_commonbratio_gsumlnported/special_math_commonbratio_betalnported/special_math_commonbratio_betaln_60ported/special_math_commonbratio_erf_nswcported/special_math_commonbratio_erfc1ported/special_math_commonbratio_rexpported/special_math_commonbratio_psiported/special_math_commonbratio_fpserported/special_math_commonbratio_apserported/special_math_commonbratio_bpserported/special_math_commonbratio_bupported/special_math_commonbratio_brcompported/special_math_commonbratio_brcmp1ported/special_math_commonbratio_bfracported/special_math_commonbratio_bgratported/special_math_commonbratio_grat1ported/special_math_commonbratio_basymported/special_math_commonbratioported/special_math_commonsample_meanported/statistical_tests_familysample_varianceported/statistical_tests_familyvalidate_positive_dfported/statistical_tests_familyt_probabilityported/statistical_tests_familyt_test_paired_kernelported/statistical_tests_familyt_test_equal_variance_kernelported/statistical_tests_familyt_test_unequal_variance_kernelported/statistical_tests_family
Argument and result plumbing
No implementation has been published with a Handbook test suite for this function.
Version differences
No 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.
Alternatives
T.TEST is the modern spelling; TDIST accepts a supplied t statistic; F.TEST compares variances.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents