Compare Two Age Groups With a t-Test in Excel
Question details
Determine whether the mean ages of married and unmarried participants differ significantly.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Compare ages from two independent groups with different sample sizes.
- Observed behavior
- The user needs an appropriate statistical test and a way to interpret its result.
Put the ages for each group in separate columns and check that the values are numeric and that participants belong to only one group. Review the data for substantial outliers or strong skew, particularly if either sample is small.
Run Welch’s two-sample t-test in Excel
Use this test to compare mean ages in independent groups when their variances may differ.
Welch’s t-test accommodates unequal group sizes and does not assume equal variances. It is appropriate when the observations are independent and the data are approximately normal, especially for small samples.
Enter married participants’ ages in column A and unmarried participants’ ages in column B, with headers in row 1.
Select an empty cell and enter =T.TEST(A2:A98,B2:B34,2,3). Replace the ranges with the cells containing your own age data.
Compare the returned p-value with your chosen significance level, such as 0.05. A p-value below that level indicates a statistically significant difference in mean ages; otherwise, the test does not establish a difference.

Calculate the two-sample t-test in WPS Spreadsheets
Use the T.TEST formula in WPS Spreadsheets to compare the mean ages of two independent groups and return a p-value.
- 1. Open your spreadsheet: In WPS Spreadsheets, open your workbook or create a new spreadsheet.
- 2. Enter the age groups: Place the ages for each independent group in separate columns, with a header above each group.
- 3. Calculate the p-value: Select an empty cell and enter =T.TEST(A2:A98,B2:B34,2,3), adjusting both ranges to match your data.
- 4. Compare the result: Compare the displayed p-value with your chosen significance level, such as 0.05.

Frequently Asked Questions
Can I use a t-test when the groups have different sizes?
Yes. Welch’s two-sample t-test accommodates different group sizes. In Excel, use T.TEST with 3 as the final argument to allow for unequal variances.
What does the 2 in the T.TEST formula mean?
The third argument, 2, requests a two-tailed test. It checks for a difference in either direction between the two population means.
What if the age data are strongly skewed or contain substantial outliers?
Review the data and consider a Mann–Whitney U test instead. It is not available as a standard built-in Excel formula, and it addresses a different statistical question from a test of means.
Does a p-value above 0.05 prove the groups have the same mean age?
No. It means the test did not find sufficient evidence of a difference at the 0.05 significance level; it does not prove the means are equal.




