CHISQ.TEST
Returns the right-tail p-value from a chi-square goodness-of-fit style comparison.
CHISQ.TEST compares observed and expected values and computes 1 - CHISQ.DIST(...).
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=CHISQ.TEST(actual_range, expected_range)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
actual_range | number (range) | Required | — |
expected_range | number (range) | Required | — |
Differences from Excel
An expected count of zero returns #NUM! in Formualizer and #DIV/0! in Excel.
Remarks
actual_rangeandexpected_rangemust have matching shapes and numeric counts.- Expected values must be strictly greater than
0. - For a two-dimensional table, degrees of freedom are
(rows - 1) * (columns - 1). For a row or column vector, they are the number of collected numeric points minus one. - Numeric collection retains statistical coercion/ignoring rules; cell errors propagate.
Error cases
- Requires
df >= 1; a 1×1 input returns#NUM!. - Returns
#N/Afor shape/count mismatches or empty numeric inputs, and#NUM!for invalid expected values.
Examples
Compare observed counts with expected counts for a two-by-two table.
Formula =CHISQ.TEST({10,20;20,10},{15,15;15,15})
Expected result 0.00982327450751919
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Move the observations closer to their expected values.
Formula =CHISQ.TEST({12,18;18,12},{15,15;15,15})
Expected result 0.121335250358482
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Use identical observed and expected counts.
Formula =CHISQ.TEST({15,15;15,15},{15,15;15,15})
Expected result 1
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
A zero expected count leaves a term with a zero denominator.
Formula =CHISQ.TEST({10,20;20,10},{15,15;0,15})
Expected result #NUM!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Perfect match between observed and expected
Formula =CHISQ.TEST({20,30,50},{20,30,50})
Expected result 1
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Two-category chi-square test
Formula =CHISQ.TEST({18,22},{20,20})
Expected result 0.527089256865538
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.