# Google Sheets CHITEST Function: Syntax, Examples & Tips

- URL: https://betteranalyst.com/google-sheets/chitest-function
- Author: Better Analyst

Formula Bot is now Better Analyst—same account, more powerful analysis.Formula Bot is now Better Analyst—same account and workflows, with more powerful analysis, dashboards, and automation.

[Learn what changed](https://betteranalyst.com/formula-bot-is-now-better-analyst)

Returns the p-value of a chi-square test. Legacy version of CHISQ.TEST.

```
=CHITEST(observed_range, expected_range)
```

Generate FormulaExplain Formula

One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.

Describe the CHITEST you need in plain EnglishGenerate Formula

## Parameters

| Parameter | Required | Description |
| - | - | - |
| **observed\_range** | Yes | The observed counts in a row, column, or table. |
| **expected\_range** | Yes | The expected counts. Must match the size and shape of **observed\_range**. |

## What Is CHITEST?

CHITEST performs a chi-square test and returns its p-value. It compares the counts you recorded with the counts you would expect if there were no effect, and tells you how likely differences of that size would be by chance alone.

CHITEST is a **legacy function** kept for compatibility. Its modern equivalent is [CHISQ.TEST](https://betteranalyst.com/google-sheets/chisqtest-function), which takes the same two ranges and returns the same result. Prefer CHISQ.TEST in new sheets; use this page to understand or maintain older formulas.

## How CHITEST Works

You give CHITEST two ranges of the same size:

- **observed\_range**: the counts you actually recorded
- **expected\_range**: the counts you would expect if the null hypothesis were true

CHITEST calculates the chi-square statistic, the sum of (observed − expected)² ÷ expected over every cell, and converts it to a right-tailed p-value. Degrees of freedom are worked out from the shape of the ranges:

- A single row or single column of *n* cells uses *n* − 1 degrees of freedom (goodness-of-fit).
- A table with *r* rows and *c* columns, where both are greater than 1, uses (*r* − 1) × (*c* − 1) (test of independence).

The result is the p-value only. CHITEST does not return the statistic itself.

## Basic Examples

### Goodness-of-fit

Observed counts of 30 and 20 in B2:B3, with expected counts of 25 and 25 in C2:C3:

```
=CHITEST(B2:B3, C2:C3)
```

The statistic is (5² ÷ 25) + (5² ÷ 25) = 2 with 1 degree of freedom, so the result is about 0.157. A 60/40 split in 50 trials is not strong evidence against an even split.

### Test of independence in a table

With observed counts in B2:D3 (2 rows × 3 columns), build the expected table in G2:I3 using row and column totals:

```
=SUM($B2:$D2) * SUM(B$2:B$3) / SUM($B$2:$D$3)
```

Fill that formula across G2:I3, then:

```
=CHITEST(B2:D3, G2:I3)
```

This returns the p-value with (2 − 1) × (3 − 1) = 2 degrees of freedom.

### Even distribution across categories

```
=CHITEST(B2:B8, ARRAYFORMULA(B2:B8*0 + SUM(B2:B8)/7))
```

Tests whether counts for the seven days of the week are spread evenly, generating the expected counts inline.

### Labelling the result

```
=IF(CHITEST(B2:D3, G2:I3) < 0.05, "Related", "No evidence of a relationship")
```

## Getting the Statistic Too

If you also want to report the chi-square statistic, calculate it alongside the p-value:

```
=SUMPRODUCT((B2:D3-G2:I3)^2/G2:I3)
```

Feed it to CHISQ.DIST.RT with the degrees of freedom and you will get the same p-value that CHITEST returns.

## Common Use Cases

- **A/B testing**: are conversion counts independent of the variant shown?
- **Survey analysis**: does preference differ by region, age group, or plan?
- **Quality**: are defects spread evenly across shifts or machines?
- **Marketing**: does channel mix differ between new and returning customers?

## Common Errors

- **#N/A or an error from mismatched ranges**: The observed and expected ranges must be the same size and shape.
- **Expected counts of zero**: Division by zero makes the test impossible. Combine sparse categories.
- **Passing percentages instead of counts**: Both ranges should be counts. Expected values in proportions understate the statistic.
- **Expected totals not matching**: Expected counts should add up to the same total as the observed counts.
- **Small samples**: When many expected counts are below about 5, the chi-square approximation is unreliable.

## Tips and Best Practices

- Build expected counts with formulas rather than typing them, so they update with the data.
- Report the p-value together with the statistic and degrees of freedom.
- A small p-value says the variables are related, not how strongly. Look at the table itself to see where the differences are.

## Related Functions

- [CHISQ.TEST](https://betteranalyst.com/google-sheets/chisqtest-function): p-value of a test from observed and expected tables
- [CHIDIST](https://betteranalyst.com/google-sheets/chidist-function): legacy right-tailed probability
- [CHIINV](https://betteranalyst.com/google-sheets/chiinv-function): legacy inverse right-tailed function
- [CHISQ.DIST.RT](https://betteranalyst.com/google-sheets/chisqdistrt-function): right-tailed probability (p-value)
- [IF](https://betteranalyst.com/google-sheets/if-function): turn a p-value into a decision

## Example use case

An HR analyst maintaining an older engagement workbook finds =CHITEST(B2:D4, G2:I4). Understanding that it returns the p-value of a chi-square test of independence between department and survey response, they confirm the result matches CHISQ.TEST before modernising the sheet.

## Need more help with Google Sheets formulas?

Sign up for Better Analyst and get unlimited AI-powered formula generation, explanations, and advanced data analysis.

[Create Free Account](https://betteranalyst.com/signup)[Try Formula Generator](https://betteranalyst.com/excel-ai)

## Google Sheets how-to guides

- [How To Insert Checkbox In Google Sheets](https://betteranalyst.com/google-sheets/how-to-insert-checkbox-in-google-sheets)
- [How To Insert Multiple Rows In Google Sheets](https://betteranalyst.com/google-sheets/how-to-insert-multiple-rows-in-google-sheets)
- [How To Lock A Row In Google Sheets](https://betteranalyst.com/google-sheets/how-to-lock-a-row-in-google-sheets)
- [How To Lock Cells In Google Sheets](https://betteranalyst.com/google-sheets/how-to-lock-cells-in-google-sheets)
- [How To Make A Copy Of An Google Sheets Sheet](https://betteranalyst.com/google-sheets/how-to-make-a-copy-of-an-google-sheets-sheet)
- [How To Make A Graph In Google Sheets](https://betteranalyst.com/google-sheets/how-to-make-a-graph-in-google-sheets)
- [How To Make A Histogram In Google Sheets](https://betteranalyst.com/google-sheets/how-to-make-a-histogram-in-google-sheets)
- [How To Make A Line Graph In Google Sheets](https://betteranalyst.com/google-sheets/how-to-make-a-line-graph-in-google-sheets)

## Explore all Google Sheets formulas

Browse our complete library of Google Sheets formula guides

Compare your options

## Decide with evidence, not a sales pitch.

Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.

1. [01ChatGPTOpen a balanced comparison prompt in ChatGPT.](https://chatgpt.com/?prompt=Compare%20Better%20Analyst%20with%20using%20a%20general-purpose%20AI%20assistant%20for%20data%20analysis.%20Evaluate%20spreadsheet%20and%20document%20analysis%2C%20dashboards%2C%20repeatable%20reports%2C%20code%20transparency%2C%20data%20connections%2C%20pricing%2C%20and%20limitations.%20Use%20current%20public%20sources%2C%20distinguish%20verified%20facts%20from%20assumptions%2C%20and%20explain%20which%20types%20of%20users%20each%20option%20fits%20best.)
2. [02ClaudeOpen the same research prompt in Claude.](https://claude.ai/new?q=Compare%20Better%20Analyst%20with%20using%20a%20general-purpose%20AI%20assistant%20for%20data%20analysis.%20Evaluate%20spreadsheet%20and%20document%20analysis%2C%20dashboards%2C%20repeatable%20reports%2C%20code%20transparency%2C%20data%20connections%2C%20pricing%2C%20and%20limitations.%20Use%20current%20public%20sources%2C%20distinguish%20verified%20facts%20from%20assumptions%2C%20and%20explain%20which%20types%20of%20users%20each%20option%20fits%20best.)
3. [03PerplexityResearch the comparison with linked web sources.](https://www.perplexity.ai/search?q=Compare%20Better%20Analyst%20with%20using%20a%20general-purpose%20AI%20assistant%20for%20data%20analysis.%20Evaluate%20spreadsheet%20and%20document%20analysis%2C%20dashboards%2C%20repeatable%20reports%2C%20code%20transparency%2C%20data%20connections%2C%20pricing%2C%20and%20limitations.%20Use%20current%20public%20sources%2C%20distinguish%20verified%20facts%20from%20assumptions%2C%20and%20explain%20which%20types%20of%20users%20each%20option%20fits%20best.)

AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.
