How to Do an F-Test in Excel: Step-by-Step Guide
In this article
To run an F-test in Excel, use the built-in F.TEST function: enter =F.TEST(array1, array2) in a cell, replacing the two arguments with the ranges of your two data samples. Excel returns the two-tailed p-value for the null hypothesis that the two populations have equal variances. If that p-value is below your chosen significance level (commonly 0.05), you reject equal variances; otherwise you do not. The function is available in Excel 2010 and later, including Microsoft 365, and in Excel for Mac. The older FTEST function does the same thing and remains for compatibility.
What You'll Need
- Two columns or rows of numeric sample data, each with at least two values. The F-test is sensitive to very small samples, so more data gives a more reliable result.
- Excel 2010 or later (Windows or Mac), or Microsoft 365. The function is not available in Excel for the web in all plans, so use the desktop app if the formula returns an error.
- Your data should be continuous numeric values, not text or blanks. Empty cells and text are ignored by the function, which can silently shrink your sample.
- A significance level in mind, usually 0.05. This is your threshold for deciding whether the variances differ.
Step-by-Step
- Lay out your data. Put sample 1 in one column (for example A2:A21) and sample 2 in another (B2:B21). Keep headers out of the ranges you will select, or the function will ignore them as text but you may accidentally include them in a range and get a smaller count than you expect.
- Pick an empty cell for the result. Click a cell such as D2 where you want the p-value to appear.
- Enter the formula. Type
=F.TEST(A2:A21,B2:B21)and press Enter. Use a comma between the two ranges in most locales; some European locales use a semicolon as the list separator, so if you get a formula error, try=F.TEST(A2:A21;B2:B21). The exact separator depends on your region settings. - Read the result. The cell shows a number between 0 and 1. This is the two-tailed probability that the two samples come from populations with the same variance. A small value (for example 0.03) suggests the variances differ; a large value (for example 0.42) suggests they do not.
- Compare with your significance level. If the p-value is less than 0.05, reject the null hypothesis of equal variances. If it is greater than or equal to 0.05, you do not have enough evidence to say the variances differ. State the result in plain terms: for example, "The variances are significantly different at the 5% level."
- Optionally, confirm with the Data Analysis ToolPak. If you want the F statistic and critical value as well as the p-value, enable the ToolPak: go to File > Options > Add-ins, select Excel Add-ins in the Manage box, click Go, tick Analysis ToolPak, and click OK. On the Data tab, click Data Analysis, choose F-Test Two-Sample for Variances, and set the input ranges, alpha, and output range. Note that the ToolPak's F-test is one-tailed by default and reports the F statistic, not the two-tailed p-value that F.TEST returns. To compare with F.TEST, double the ToolPak's one-tailed p-value, or compare the reported F to the critical F. Labels can differ slightly by Excel version and region.
- Document the result. Write down the ranges used, the p-value, and the decision. This matters if you are checking the equal-variance assumption before a t-test, which is the most common reason to run an F-test in Excel.
Common Mistakes
- Including headers or text in the ranges. The function ignores text, but if a range contains blanks or labels, the effective sample size changes and the p-value is computed on fewer points than you think.
- Treating the result as a test of means. F.TEST compares variances, not averages. If you want to compare means, use a t-test (T.TEST) and use the F-test only to decide whether to assume equal variances.
- Forgetting that F.TEST is two-tailed. The p-value from F.TEST is two-tailed. The Data Analysis ToolPak's F-test is one-tailed. Mixing the two and comparing the wrong number to 0.05 is a common source of wrong conclusions.
- Using it on paired data. The F-test assumes independent samples. If your two columns are before-and-after measurements on the same subjects, the independence assumption is violated and the result is not meaningful.
- Ignoring the normality assumption. The F-test is sensitive to non-normal data, especially with small samples. If your data are heavily skewed or have outliers, consider a different approach or consult a statistician.
- Using it with very small samples. With only two or three values per group, the test has almost no power and the p-value is unstable. Collect more data where possible.
Tips
- Use named ranges or Excel Tables so your formula updates automatically when you add data. Select your data, press Ctrl+T (Cmd+T on Mac) to create a table, then refer to the columns by name.
- Check your sample sizes first with
=COUNT(A2:A21). If the counts differ greatly, the F-test still works but the result is less robust. - To see the F statistic itself, use
=F.TEST(range1,range2)for the p-value and compute the ratio of variances with=VAR.S(range1)/VAR.S(range2). The larger variance should go on top if you want an F value of 1 or more. - Round the p-value for reporting, but keep the full value in the cell for your own decision. Do not round before comparing to 0.05.
- If you are checking assumptions before a t-test, run the F-test first, then choose the t-test variant (equal or unequal variances) based on the result. Excel's T.TEST has a tails and type argument; type 2 assumes equal variances and type 3 does not.
Troubleshooting
- #VALUE! error. One of the ranges contains text that Excel cannot interpret, or the ranges are not valid references. Check that both arguments point to numeric cells only. Text is normally ignored, but a malformed reference causes this error.
- #DIV/0! error. One of the samples has a variance of zero (all values identical) or fewer than two numeric values. The F-test cannot be computed. Check with
=VAR.S(range). - #NAME? error. The function name is misspelled or your Excel version does not recognise F.TEST. Try the legacy name
=FTEST(range1,range2), which works in older versions. If both fail, the function may not be supported in your edition. - #N/A error. The two ranges have different numbers of data points in a way the function cannot pair, or one range is empty. F.TEST does not require equal sample sizes, so this usually means a range reference is wrong.
- Unexpectedly large or small p-value. Recheck the ranges. A common cause is selecting an entire column (A:A) that includes the header and many blanks, or selecting the wrong column. Use explicit ranges like A2:A21.
- Formula separator error. If your region uses semicolons, replace commas with semicolons. Excel usually corrects this automatically, but not always.
- ToolPak not listed. The Analysis ToolPak is not available in Excel for the web. Use the desktop version. On Mac, it is under Tools > Excel Add-ins.
Frequently Asked Questions
What does the F.TEST function actually return?
It returns the two-tailed p-value for the null hypothesis that the two populations have equal variances. It does not return the F statistic itself; compute that separately as the ratio of the two sample variances.
Is F.TEST the same as the F-test in the Data Analysis ToolPak?
No. F.TEST returns a two-tailed p-value. The ToolPak's F-Test Two-Sample for Variances returns a one-tailed p-value plus the F statistic and critical value. To compare them, double the ToolPak p-value or compare the F statistic to the critical value.
Can I use F.TEST with different sample sizes?
Yes. The two ranges do not need the same number of values. Each range must contain at least two numeric values.
Should I use F.TEST before a t-test?
It is a common check of the equal-variance assumption. If the p-value is below your significance level, use the t-test variant that does not assume equal variances (type 3 in T.TEST). If it is above, the equal-variance variant (type 2) is reasonable.
Does F.TEST work in Excel for the web?
F.TEST is generally available in Excel for the web, but the Analysis ToolPak is not. If the formula fails in the browser, open the workbook in the desktop app.
What significance level should I use?
0.05 is the most common choice. Use a smaller level such as 0.01 if you need stronger evidence, and state the level you used when reporting the result.