Statistical functions

CHISQ.TEST

Close: 2 of 18 recorded answers differ in the last bits, worst 3 ULP

Everything else matches (5 in the answer bank and 13 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
ArabicCHISQ.TEST
BulgarianCHISQ.TEST
CzechCHISQ.TEST
DanishCHI2.TEST
GermanCHISQ.TEST
GreekCHISQ.TEST
English (Australia)CHISQ.TEST
English (United Kingdom)CHISQ.TEST
English (United States)CHISQ.TEST
SpanishPRUEBA.CHICUAD
EstonianCHISQ.TEST
FinnishCHINELIÖ.TESTI
FrenchCHISQ.TEST
HebrewCHISQ.TEST
CroatianCHISQ.TEST
HungarianKHINÉGYZET.PRÓBA
IndonesianCHISQ.TEST
ItalianCHISQ.TEST
JapaneseCHISQ.TEST
KoreanCHISQ.TEST
LithuanianCHISQ.TEST
LatvianCHISQ.TEST
NorwegianCHISQ.TEST
DutchCHIKW.TEST
PolishCHI.TEST
Portuguese (Brazil)CHISQ.TEST
Portuguese (Portugal)TESTE.CHIQ
RomanianCHISQ.TEST
RussianХИ2.ТЕСТ
SlovakCHISQ.TEST
SlovenianCHISQ.TEST
Serbian (Latin)CHISQ.TEST
SwedishCHI2.TEST
ThaiCHISQ.TEST
TurkishKİKARE.TEST
UkrainianCHISQ.TEST
VietnameseCHISQ.TEST
Chinese (Simplified)CHISQ.TEST
Chinese (Hong Kong)CHISQ.TEST
Chinese (Traditional)CHISQ.TEST

Names from Microsoft's support site.

What it does

CHISQ.TEST(actual_range, expected_range)

CHISQ.TEST(actual_range, expected_range) returns a chi-square right-tail test probability from observed and expected frequencies. Supply the expected counts explicitly; the function does not infer them from labels.

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.

=CHISQ.TEST({12,8},{10,10}) is about 0.37109337. The statistic is (12-10)^2/10+(8-10)^2/10=0.8, with one degree of freedom for a one-row, two-category comparison.

Quirks

The arrays need matching shapes; a mismatch gives #N/A in the current wrapper. A one-cell comparison also gives #N/A because it supplies no positive degree count. The output is a tail probability, rather than the chi-square statistic itself.

The current wrapper requires a numeric value at every paired position and returns #VALUE! for text, logical or blank cells; it does not compact those cells into a shorter sample. It propagates a direct argument error before comparing shapes, then checks cell errors during traversal. A nonpositive expected count gives #NUM! in this code.

For an independence table, calculate expected counts from row total times column total divided by grand total before calling the function. The function takes those expected values as inputs. Its p-value is conditional on the chosen model and expected table.

How to implement

  1. Resolve the two input grids and retain their row and column counts. Propagate a direct scalar argument error before a shape mismatch. Reject unequal shapes.
  2. Set degrees of freedom to (rows-1)*(columns-1) when both dimensions exceed one, columns-1 for one row or rows-1 for one column. Reject zero degrees.
  3. Traverse paired positions in row order. Propagate a cell error, require two numbers and reject a nonpositive expected value under the current rules.
  4. With ordinary binary64 stores, form delta=actual-expected, square=delta*delta, contribution=square/expected and statistic=statistic+contribution from an initial zero.
  5. Evaluate the chi-square right tail at that stored statistic and degree count.

The starter example contributes 4/10=0.4 from each category, giving statistic 0.8 and one degree. For an independence layout {12,8;8,12}, both row totals and both column totals are twenty and the grand total forty, so every expected count is ten. Its four contributions total 1.6, still with one degree because (2-1)*(2-1)=1.

Keep admission, statistic reduction and the numerical right-tail routine as separate stages. The loop describes current code; the forward distribution’s last bits and other recorded residuals remain unresolved.

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.

CHISQ.TEST · 3 lines · calc-func/src/catalogue/distributions.rs on GitHub
100 chisq_test "CHISQ.TEST" (2, 2) [R "actual_range", R "expected_range"] |s, a, sv| {
    chisq_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

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.

Excel 16.0 buildPlatform and CPUCaptured inputs
20131Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics5

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

Recorded environments and comparison details.

Excel 16.0 build 20131

Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics

5 captured inputs are indexed for this environment. Capture dates: 2026-07-12 to 2026-07-12. This is a reading count, not a comparison with another build.

Alternatives

CHISQ.DIST.RT evaluates a supplied statistic; CHISQ.INV.RT finds a critical value. F.TEST compares sample variances.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents