Statistical functions
T.INV.2T
Close: 1 of 4 recorded answers differ in the last bits, worst 1 ULP
Everything else matches (4 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 | T.INV.2T |
| Bulgarian | T.INV.2T |
| Czech | T.INV.2T |
| Danish | T.INV.2T |
| German | T.INV.2T |
| Greek | T.INV.2T |
| English (Australia) | T.INV.2T |
| English (United Kingdom) | T.INV.2T |
| English (United States) | T.INV.2T |
| Spanish | INV.T.2C |
| Estonian | T.INV.2T |
| Finnish | T.KÄÄNT.2S |
| French | LOI.STUDENT.INVERSE.BILATERALE |
| Hebrew | T.INV.2T |
| Croatian | T.INV.2T |
| Hungarian | T.INVERZ.2SZ |
| Indonesian | T.INV.2T |
| Italian | T.INV.2T |
| Japanese | T.INV.2T |
| Korean | T.INV.2T |
| Lithuanian | T.INV.2T |
| Latvian | T.INV.2T |
| Norwegian | T.INV.2T |
| Dutch | T.INV.2T |
| Polish | ROZKŁ.T.ODWR.DS |
| Portuguese (Brazil) | T.INV.2T |
| Portuguese (Portugal) | INV.T.2C |
| Romanian | T.INV.2T |
| Russian | СТЬЮДЕНТ.ОБР.2Х |
| Slovak | T.INV.2T |
| Slovenian | T.INV.2T |
| Serbian (Latin) | T.INV.2T |
| Swedish | T.INV.2T |
| Thai | T.INV.2T |
| Turkish | T.TERS.2K |
| Ukrainian | T.INV.2T |
| Vietnamese | T.INV.2T |
| Chinese (Simplified) | T.INV.2T |
| Chinese (Hong Kong) | T.INV.2T |
| Chinese (Traditional) | T.INV.2T |
Names from Microsoft's support site.
What it does
T.INV.2T(probability, deg_freedom)
T.INV.2T(probability, deg_freedom) returns the two-tailed critical value of Student's
t-distribution with ν degrees of freedom. Microsoft states the definition directly: it returns
"that value t, such that P(|X| > t) = probability where X is a random variable that
follows the t-distribution".
So it is the exact inverse of T.DIST.2T, and it is related to the left-tail quantile of T.INV by
T.INV.2T(p, ν) = T.INV(1 − p/2, ν) = − T.INV(p/2, ν)
This is the number printed in every statistics textbook's t table. Asking for the 5% two-sided
critical value at 10 degrees of freedom is T.INV.2T(0.05, 10).
Because P(|T| > t) is continuous and strictly decreasing from 1 at t = 0 to 0 as t → ∞,
the inverse exists and is unique on p ∈ (0, 1], with
T.INV.2T(1, ν) = 0 exactly, for every ν
T.INV.2T(p, ν) → +∞ as p → 0⁺
The range is [0, ∞): this surface never returns a negative number. That is worth stating
plainly, because it is the fastest way to tell it apart from T.INV, which returns negative
values for p < ½.
Closed forms at the two small integer degrees of freedom, obtained by inverting the elementary two-tail formulas:
| ν | T.INV.2T(p, ν) |
|---|---|
| 1 | cot(πp/2) = tan(π(1 − p)/2) |
| 2 | sqrt( 2(1 − p²) / p² ) = sqrt(2)·sqrt(1 − p²)/p |
| ν → ∞ | NORM.S.INV(1 − p/2) |
Both are exact and elementary — a full parameter slice each on which any implementation can be checked against arithmetic instead of against another approximation.
Deep-tail growth: as p → 0⁺ the critical value grows like p^{−1/ν}, so it explodes as a power
law, violently for small ν (ν = 1 gives growth proportional to 1/p) and gently for large ν.
An implementation whose starting bracket is derived from the normal quantile — which grows only
like sqrt(−2 ln p) — will start catastrophically low in the small-ν tail.
Arguments
| Argument | Meaning | Required |
|---|---|---|
probability | The two-tail probability P(|T| > t). | Yes |
deg_freedom | ν, the number of degrees of freedom. Non-integer values are documented as truncated. | Yes |
Documented admissible range: #NUM! when probability ≤ 0 or probability > 1, so
probability = 1 is admitted — and here, unlike on T.INV, that is mathematically fine: the
answer is exactly 0. The two inverse surfaces have opposite behaviour at their shared documented
boundary, which is a small but real reason to keep them straight.
Microsoft documents that a non-integer deg_freedom is truncated, and that one-tailed values can
be recovered by passing 2 * probability.
Numeric slots take ordinary to-number coercion; see Coercion and lifting.
Try it
Quirks
Result and edge cases
Returns Number, a non-negative critical value.
probability = 1is exactly 0. Free and exact.probabilitynear 0 is where the critical value is large and where the problem is badly conditioned:dt/dp = −1/(2 f(t; ν)), and the density in the tail is tiny, so a one-ulp change inpmovesta long way. No algorithm can recover accuracy the input does not contain. This is why a tail critical value is a fundamentally harder request than a central one.probabilitynear 1 is the opposite corner:tis near 0 and the answer has plenty of absolute room, but computing it fromT.INV(1 − p/2, ν)would form1 − p/2forpnear 1 and lose relative precision in the small quantity. A direct two-tail search does not have that problem, which is an argument for this surface existing rather than being a wrapper.- Round trip.
T.DIST.2T(T.INV.2T(p, ν), ν)should returnp. Microsoft's own remark makes this the defining relationship rather than a nice property: the value is found by seeking it.
Errors
As documented on Microsoft's T.INV.2T page:
| Error | Documented condition |
|---|---|
#VALUE! | Either argument is nonnumeric. |
#NUM! | probability ≤ 0 or probability > 1. |
#NUM! | deg_freedom < 1. |
Errors in either argument propagate under the universal coercion rule. The Handbook has not verified any of this against Excel.
How to implement
Numerical notes
Microsoft is unusually forthcoming here, and what it says shapes the whole section: the page
states that T.INV.2T uses an iterative seek for the x at which the forward two-tail function
equals probability, and that the precision of T.INV.2T depends on the precision of
T.DIST.2T. That is a documented statement about an algorithm, and it is rare enough in
Excel's documentation to be worth taking seriously: it says the inverse is not independently
accurate, and that any error in the forward surface is inherited.
Three consequences follow.
Error inheritance is not neutral — it is amplified by the conditioning. If the forward
surface has relative error ε at t, the induced error in the recovered t is roughly
ε · p / f(t; ν). In the tail, where f is tiny, that factor is large. An inverse built by
iterating on a forward function that is good to a few ulp can still be poor in absolute terms far
out, and no amount of iteration fixes it.
The stopping rule has to be stated in the right variable. Iterating to a fixed tolerance on
t over-solves in the centre and under-solves in the tail; iterating to a fixed tolerance on p
does the reverse. A defensible implementation iterates on p with a relative tolerance and
polishes with one Newton step whose derivative is the density — which is available in closed
form from T.DIST(·, ν, FALSE).
There is a better route than iteration. The two-tail critical value follows analytically from
the inverse regularized incomplete beta: with y = I⁻¹_p(ν/2, ½), t = sqrt(ν(1 − y)/y). Cephes'
incbi, Boost.Math's ibeta_inv, and the DCDFLIB/TOMS lineage all provide the inverse beta with
stated error bounds, so a natural-best implementation should take this route and reserve
iteration for the polish step. Hill's classic t-quantile algorithm and the expansion in A&S
26.7.5 give the starting approximation when iteration is used; both are stated in terms of the
normal deviate and both need a tail correction for small ν, for exactly the power-law reason
given above.
Nothing here is a claim about what Excel actually does beyond what its own page says.
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.
T.INV.2T · 4 lines · calc-func/src/catalogue/distributions.rs on GitHub45 t_inv_2t "T.INV.2T" (2, 2) [V "probability", V "deg_freedom"] |s, a, sv| {
let [p, df] = nums::<2>(s, a)?;
out(s, cft::t_inv_2t_kernel(p, df))
}
Kernels shared with other functions
numscatalogue/distributionstruncate_positive_integerported/chi_f_t_familyvalidate_probability_open_unitported/chi_f_t_familysearch_upper_boundported/chi_f_t_familyt_inv_2t_kernelported/chi_f_t_familybinary_withported/excel_numerictan_withported/excel_numericexcel_tanported/excel_numericexcel_x87_addported/excel_numericexcel_x87_mulported/excel_numericexcel_x87_mul_addported/excel_numericpack_rawported/excel_numeric/soft87zeroported/excel_numeric/soft87infported/excel_numeric/soft87packported/excel_numeric/soft87ext_piported/excel_numeric/soft87ext_oneported/excel_numeric/soft87ext_chsported/excel_numeric/soft87mulported/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_commonbisect_inverseported/special_math_commontan_kernelported/tan
Argument and result plumbing
No implementation has been published with a Handbook test suite for this function.
Version differences
No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.
Alternatives
Relationships
- T.DIST.2T is the forward function this inverts, and Microsoft's page names it as such.
- T.INV is the left-tail quantile, a different function. The conversion is
T.INV.2T(p, ν) = T.INV(1 − p/2, ν). UsingT.INV(p, ν)whereT.INV.2T(p, ν)was meant gives a number of the wrong sign and the wrong magnitude, and it will not look obviously wrong in a spreadsheet. TINVis this surface's legacy spelling — notT.INV's.TINV(p, ν)andT.INV.2T(p, ν)are documented to compute the same quantity. Whether they compute it the same way, and publish the same bits, is not established. The Handbook's alias-pairing record for the legacy/modern collapse covers five forward CDF pairs and states in terms that no inverse pair —GAMMAINV/GAMMA.INV,CHIINV/CHISQ.INV.RT,BETAINV/BETA.INV,FINV/F.INV.RT, andTINV/T.INV.2T— has ever been probed for identity. Treating the legacy and modern inverse spellings as interchangeable is an assumption, and this Handbook names it as one.- T.DIST.RT: there is no
T.INV.RT. The right-tail critical value is spelledT.INV(1 − p, ν)orT.INV.2T(2p, ν); the second form is preferable, because it does not form1 − p. CONFIDENCE.Tis the packaged consumer: a t-based confidence half-width isT.INV.2T(alpha, n−1) · s / sqrt(n).T.TESTgoes the other way — it returns ap-value, not a critical value.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents