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
LanguageName in Excel
ArabicTTEST
BulgarianTTEST
CzechTTEST
DanishTTEST
GermanTTEST
GreekTTEST
English (Australia)TTEST
English (United Kingdom)TTEST
English (United States)TTEST
SpanishPRUEBA.T
EstonianTTEST
FinnishTTESTI
FrenchTEST.STUDENT
HebrewTTEST
CroatianTTEST
HungarianT.PRÓBA
IndonesianTTEST
ItalianTTEST
JapaneseTTEST
KoreanTTEST
LithuanianTTEST
LatvianTTEST
NorwegianTTEST
DutchT.TOETS
PolishTEST.T
Portuguese (Brazil)TTEST
Portuguese (Portugal)TESTET
RomanianTTEST
RussianТТЕСТ
SlovakTTEST
SlovenianTTEST
Serbian (Latin)TTEST
SwedishTTEST
ThaiTTEST
TurkishTTEST
UkrainianTTEST
VietnameseTTEST
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

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

=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.

TypeStandard error SEDegrees v
1, paired differences dsqrt(s_d²/n)n-1
2, pooledsqrt(s_p²*(1/n1+1/n2)), with s_p²=((n1-1)*s1²+(n2-1)*s2²)/(n1+n2-2)n1+n2-2
3, unequal variancessqrt(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 GitHub
105 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

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