Function Problems

How to Perform a Chi-Square Test of Independence in Excel

Chanuka GeekiyanageChanuka Geekiyanage Nov 10, 2026 872 views

Question details

The user needs to perform a chi-square test of independence on a contingency table but cannot locate the tool in the Analysis ToolPak, seeking an alternative formula or add-in.

How to Perform a Chi-Square Test of Independence in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
Analyzing categorical variables using a contingency table for statistical data analysis.
Observed behavior
The standard Analysis ToolPak does not include a dedicated chi-square independence test, requiring the use of manual functions or third-party statistical add-ins.
Before you start

Ensure your observed data is arranged in a contingency table with calculated row, column, and grand totals. You will need to manually calculate the expected values table before applying the function.

Solution 1Recommended

Use the CHISQ.TEST Built-in Function

Calculate the expected counts manually and use Excel's native formula to get the p-value quickly without installing additional add-ins.

Since the Analysis ToolPak does not directly offer a chi-square test, using the built-in CHISQ.TEST formula is the most direct approach. This function calculates the p-value associated with a chi-square test.

1
Calculate expected values

Create a new table of the exact same dimensions as your observed data. For each cell, calculate the expected value using the formula: (Corresponding Row Total * Corresponding Column Total) / Grand Total.

2
Select a result cell

Click on an empty cell where you want the final p-value of the chi-square test to be displayed.

3
Enter the CHISQ.TEST formula

Type `=CHISQ.TEST(` into the formula bar or the cell.

4
Select the ranges

Highlight your table of observed values (excluding totals), type a comma, and then highlight your newly calculated table of expected values. Close the parenthesis so the formula looks like `=CHISQ.TEST(actual_range, expected_range)`.

5
Get the p-value

Press Enter to execute the formula. The resulting number is your p-value, determining the independence of your variables.

Use the CHISQ.TEST Built-in Function
Compatibility Note: In older versions of Excel (2007 and earlier), this function is named CHITEST instead of CHISQ.TEST.
Analyze Data Easily with WPS Office

Perform Chi-Square Tests Seamlessly in WPS Spreadsheet

WPS Spreadsheet fully supports the CHISQ.TEST function alongside a wide range of advanced statistical tools, allowing you to easily process contingency tables and perform data analysis for free.

  1. 1. Open your data in WPS Spreadsheet: Launch WPS Office and open your spreadsheet containing the observed contingency table.
  2. 2. Prepare your expected values: Create an expected values table using standard formulas referencing your row, column, and grand totals.
  3. 3. Apply the function: Click an empty cell and type `=CHISQ.TEST(actual_range, expected_range)`, selecting your observed and expected data tables respectively.
  4. 4. View your p-value: Press Enter. WPS Spreadsheet will instantly calculate and display the p-value for your test of independence.
Fully compatible with Microsoft Excel formulas, including CHISQ.TEST and CHITEST.Lightweight, fast, and free alternative to Microsoft Office.Intuitive interface for effortless data entry, formula management, and statistical analysis.Supports extensive charting capabilities to visualize your test results.
microsoft office alternative - wps office

Frequently Asked Questions

Why is the Chi-Square Test missing from the Excel Data Analysis ToolPak?

Microsoft Excel's native Data Analysis ToolPak was designed with a specific set of tools and does not include a dedicated Chi-Square test of independence interface. Users must either manually use the CHISQ.TEST formula or install a third-party add-in for automated calculations.

What is the difference between CHISQ.TEST and CHISQ.DIST?

CHISQ.TEST takes your actual and expected data ranges to calculate the p-value directly. CHISQ.DIST (or CHISQ.DIST.RT) calculates the chi-square distribution probabilities based on a manually provided chi-square statistic and degrees of freedom.

How do I calculate the degrees of freedom for a contingency table?

The degrees of freedom for a test of independence are calculated as (Number of Rows - 1) multiplied by (Number of Columns - 1). For a standard 2x2 contingency table, the degrees of freedom is 1.

Does WPS Office support the CHISQ.TEST function?

Yes, WPS Spreadsheet offers full compatibility with Excel statistical functions, including CHISQ.TEST and the legacy CHITEST, ensuring seamless data analysis.