Calculation Issues

Why MMULT Covariance Results Differ from Excel Data Analysis in WPS Spreadsheets

Huma Ashraf ChHuma Ashraf Ch Nov 13, 2026 869 views

Question details

The user wants to understand why a covariance matrix calculated with MMULT does not match Excel’s Data Analysis covariance results, especially the sample versus population divisor difference.

Why MMULT Covariance Results Differ from Excel Data Analysis in WPS Spreadsheets
Product
WPS Spreadsheets
Device & OS
not provided
Scenario
Comparing a manual MMULT covariance matrix with Excel’s Data Analysis covariance output for stock or other column data.
Observed behavior
MMULT covariance values differ from Excel Data Analysis covariance results because the manual formula often divides by n for population covariance, while Excel Data Analysis uses n-1 for sample covariance.
Before you start

Before comparing results, confirm that both methods use the same data range, row orientation, and missing-value handling. Decide whether you need sample covariance using n-1 or population covariance using n.

Solution 1Recommended

Correct the MMULT Divisor to Match Excel Data Analysis Sample Covariance

Use this when you want your manual MMULT covariance matrix to match Excel Data Analysis, which calculates sample covariance with n-1.

Excel’s Data Analysis Covariance tool normally returns sample covariance, where each pairwise covariance is divided by n-1. A manual MMULT formula that divides by the number of observations n produces population covariance, causing the mismatch.

1
Center each column by its mean

In WPS Spreadsheets, create a helper area the same size as your data. For each column, enter =A2-AVERAGE(A$2:A$61) and copy across all columns and rows to center the observations.

2
Select an output cell for the covariance matrix

Click an empty cell large enough to hold the p-by-p result, then type =MMULT(TRANSPOSE(centered_data),centered_data)/(COUNT(data)-1).

3
Confirm the result with array entry

Press Enter if WPS Spreadsheets spills the array. If not, select the full output range, type the formula, and press Ctrl+Shift+Enter to enter it as an array formula.

Correct the MMULT Divisor to Match Excel Data Analysis Sample Covariance
Sample vs population divisor: Use n-1 only for sample covariance. If you intentionally want population covariance, divide by n and do not compare it directly with Excel Data Analysis sample covariance.
WPS Spreadsheets solution

Calculate Covariance Matrices Correctly with WPS Spreadsheets

WPS Spreadsheets gives you MMULT, TRANSPOSE, COVARIANCE.S, and COVARIANCE.P to reproduce or check Excel Data Analysis covariance results. Use the n-1 divisor for sample covariance and n for population covariance, all in a free spreadsheet familiar to Excel users.

  1. 1. Open WPS Spreadsheets and load your data: Launch WPS Office, click Spreadsheets, and open the workbook containing your stock or column data.
  2. 2. Create centered observations: In a helper range, subtract each column mean from each value, such as =A2-AVERAGE(A$2:A$61), and fill across all variables.
  3. 3. Enter the MMULT formula: Click a blank cell and type =MMULT(TRANSPOSE(centered_range),centered_range)/(COUNT(data)-1) for sample covariance.
  4. 4. Apply array entry if needed: Press Enter if the formula spills, or select the output range, type the formula, and press Ctrl+Shift+Enter.
  5. 5. Compare the matrix with Excel Data Analysis: Check that the same rows and divisor are used. The sample covariance matrix should match the corresponding Excel Data Analysis output.
Free built-in MMULT and TRANSPOSE functions for covariance matricesCOVARIANCE.S and COVARIANCE.P functions for sample and population covarianceFull compatibility with Microsoft Excel .xlsx workbooksFamiliar spreadsheet interface for easy migration from ExcelLightweight and easy to use for financial and statistical analysis
microsoft office alternative - wps office

Frequently Asked Questions

Why does my MMULT covariance divide by n but Excel Data Analysis uses n-1?

Excel Data Analysis’s Covariance tool calculates sample covariance by default, so it divides by n-1. A manual MMULT formula that divides by the number of observations n calculates population covariance.

How do I center data before using MMULT in WPS Spreadsheets?

Create a helper range and subtract each column’s mean, for example =A2-AVERAGE(A$2:A$61). Fill the formula across all rows and columns before applying MMULT.

Which WPS function should I use to match Excel Data Analysis covariance?

Use COVARIANCE.S for sample covariance. Enter =COVARIANCE.S(range1,range2) or find it under Formulas > Insert Function.

Does MMULT need Ctrl+Shift+Enter in WPS Spreadsheets?

If WPS Spreadsheets does not spill the result automatically, select the full output range, type the MMULT formula, and press Ctrl+Shift+Enter to enter it as an array formula.

What should I check if my MMULT covariance still differs from Excel?

Check data orientation, same rows, missing-value treatment, mean calculation, and whether you are comparing sample covariance with n-1 or population covariance with n.