Fisher Exact Test Calculator for Excel
Calculate statistical significance for 2×2 contingency tables with precise p-values
Results
Comprehensive Guide to Fisher’s Exact Test in Excel
Fisher’s Exact Test is a statistical test used to determine if there are nonrandom associations between two categorical variables. Unlike the chi-square test, it’s particularly useful for small sample sizes where expected frequencies are less than 5. This guide explains how to perform Fisher’s Exact Test using Excel and when to apply it in your research.
When to Use Fisher’s Exact Test
- Small sample sizes (especially when any expected cell count is <5)
- 2×2 contingency tables (though extensions exist for larger tables)
- When you need exact p-values rather than approximations
- For both one-tailed and two-tailed tests
- In medical research, genetics, and social sciences where precise probabilities are crucial
Fisher’s Exact Test vs Chi-Square Test
| Feature | Fisher’s Exact Test | Chi-Square Test |
|---|---|---|
| Sample Size Requirements | Works with very small samples | Requires expected counts ≥5 in all cells |
| Calculation Method | Exact probability calculation | Approximation (asymptotic) |
| Computational Complexity | More intensive (factorial calculations) | Less intensive |
| Table Size | Primarily 2×2 (extensions available) | Any size contingency table |
| Tail Options | One-tailed or two-tailed | Primarily two-tailed |
How to Perform Fisher’s Exact Test in Excel
While Excel doesn’t have a built-in Fisher’s Exact Test function, you can implement it using these methods:
-
Using Excel Formulas (for small tables):
The test calculates the exact probability of obtaining the observed distribution (or one more extreme) under the null hypothesis. The formula involves factorials:
p = (a+b)! (c+d)! (a+c)! (b+d)! / (a! b! c! d! n!)
Where n = a+b+c+d (the grand total)
-
Using VBA Macro:
For more convenient use, you can add this VBA function to Excel:
Function FishersExact(a As Double, b As Double, c As Double, d As Double) As Double Dim n As Double, p As Double n = a + b + c + d p = Application.WorksheetFunction.Fact(n) * Application.WorksheetFunction.Fact(a + b) _ * Application.WorksheetFunction.Fact(c + d) * Application.WorksheetFunction.Fact(a + c) _ * Application.WorksheetFunction.Fact(b + d) / _ (Application.WorksheetFunction.Fact(a) * Application.WorksheetFunction.Fact(b) _ * Application.WorksheetFunction.Fact(c) * Application.WorksheetFunction.Fact(d) _ * Application.WorksheetFunction.Fact(n)) FishersExact = p End FunctionThen use =FishersExact(A1,B1,C1,D1) where A1-D1 contain your 2×2 table values.
-
Using Real Statistics Resource Pack:
The free Real Statistics Resource Pack adds Fisher’s Exact Test to Excel’s Data Analysis Toolpak. After installation:
- Enter your 2×2 table in Excel
- Go to Data Analysis → Nonparametric Tests → Fisher Exact Test
- Select your data range and options
- Click OK to see results
Interpreting Fisher’s Exact Test Results
The test provides a p-value that helps you determine whether to reject the null hypothesis (which states there’s no association between the variables).
- p-value ≤ α: Reject the null hypothesis (significant association)
- p-value > α: Fail to reject the null hypothesis (no significant association)
For example, with α = 0.05:
- p = 0.03 → Significant result (reject null hypothesis)
- p = 0.07 → Not significant (fail to reject null hypothesis)
Practical Example: Medical Research Application
Suppose we’re testing a new drug’s effectiveness with these results:
| Improved | Not Improved | Total | |
|---|---|---|---|
| Drug | 18 | 12 | 30 |
| Placebo | 12 | 28 | 40 |
| Total | 30 | 40 | 70 |
Running Fisher’s Exact Test on this data:
- Two-tailed p-value = 0.0238
- At α = 0.05, we reject the null hypothesis
- Conclusion: There’s a statistically significant association between the drug and improvement
Common Mistakes to Avoid
-
Using chi-square for small samples:
Many researchers incorrectly use chi-square when they should use Fisher’s Exact Test. Remember: if any expected cell count is <5, use Fisher's.
-
Misinterpreting one-tailed vs two-tailed:
Choose your test type before collecting data. One-tailed tests have more power but should only be used when you have a strong directional hypothesis.
-
Ignoring multiple testing:
If you’re running many Fisher’s tests, you’ll need to adjust your significance level (e.g., using Bonferroni correction) to avoid false positives.
-
Forgetting to check assumptions:
While Fisher’s has fewer assumptions than chi-square, you should still ensure your data is properly categorized and independent.
Advanced Considerations
For more complex analyses:
-
Mid-p correction:
Some statisticians recommend the mid-p correction to reduce conservatism in Fisher’s Exact Test, especially for one-sided tests.
-
Extensions for larger tables:
The Freeman-Halton extension allows Fisher’s Exact Test to be used with r×c tables (not just 2×2).
-
Bayesian approaches:
For very small samples, Bayesian methods can provide additional insight beyond p-values.
-
Effect sizes:
Always report effect sizes (like odds ratios) alongside p-values for complete interpretation.
Excel Alternatives for Fisher’s Exact Test
While Excel can perform the test, these alternatives offer more features:
| Software | Features | Learning Curve |
|---|---|---|
| R | fisher.test() function, handles large tables, mid-p option | Moderate |
| Python (SciPy) | scipy.stats.fisher_exact, integrates with data pipelines | Moderate |
| SPSS | Point-and-click interface, good for beginners | Easy |
| GraphPad Prism | Excellent visualization, biomedical focus | Easy-Moderate |
| Stata | Powerful for complex survey data, exact options | Moderate-Hard |
Frequently Asked Questions
-
Can I use Fisher’s Exact Test for 3×3 tables?
While the classic Fisher’s Exact Test is for 2×2 tables, extensions like the Freeman-Halton test handle larger tables. However, computation becomes intensive for tables larger than 3×3.
-
Why does my p-value differ between Excel and R?
Differences usually stem from:
- One-tailed vs two-tailed test selection
- Different handling of very small probabilities
- Mid-p corrections in some implementations
-
Is Fisher’s Exact Test always better than chi-square?
Not necessarily. For large samples where chi-square assumptions hold, chi-square is perfectly valid and computationally simpler. Fisher’s Exact Test shines with small samples.
-
Can I use Fisher’s Exact Test for paired data?
Yes! McNemar’s test is essentially a version of Fisher’s Exact Test for paired (matched) data.
-
What’s the minimum sample size for Fisher’s Exact Test?
There’s no strict minimum, but with very small samples (e.g., total n < 10), the test may have low power to detect true associations.
Conclusion
Fisher’s Exact Test remains an essential tool in statistical analysis, particularly valuable when working with small sample sizes where the chi-square approximation isn’t valid. While Excel requires some workarounds to perform the test, the methods outlined above provide reliable ways to implement it. For regular use, consider learning R or Python for more robust statistical testing capabilities.
Remember that statistical significance doesn’t always equate to practical significance. Always interpret your results in the context of your specific research question and consider effect sizes alongside p-values for complete understanding.