Calculation Issues

How to Calculate Residual Sum of Squares in Excel

Nimra MalikNimra Malik Nov 18, 2026 868 views

Question details

Calculate the residual sum of squares for several sets of Y values using predicted values or their means.

How to Calculate Residual Sum of Squares in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user has sets of observed Y values and wants to measure their squared differences from a corresponding mean or predicted value.
Observed behavior
The desired result is the sum of squared differences for each set, with the option to combine the results.
Before you start

Arrange each set of numeric Y values in a contiguous range and identify its corresponding predicted values or mean. Use a mean as the prediction only when that is appropriate for your analysis.

Solution 1Recommended

Calculate RSS from paired observed and predicted values

Use SUMXMY2 when each observed Y value has a corresponding predicted value.

1
Enter the paired values

Enter observed Y values in A2:A4 and their corresponding predicted values in B2:B4, keeping each pair on the same row.

2
Calculate the sum

Select an empty cell, enter =SUMXMY2(A2:A4,B2:B4), and press Enter. Excel subtracts each predicted value from its observed value, squares the differences, and sums them.

3
Repeat for other sets

Enter the same formula with the appropriate paired ranges for each additional set. To combine the set results, use SUM on the cells containing those results.

Calculate RSS from paired observed and predicted values
Match the ranges: The observed and predicted ranges must have the same dimensions, and each row must represent a matching pair.
Calculate RSS in WPS Spreadsheets

Calculate Residual Sum of Squares in WPS Spreadsheets

Use WPS Spreadsheets to calculate squared differences from a mean and work with Excel-compatible files in a familiar spreadsheet interface.

  1. 1. Open a spreadsheet: Open WPS Spreadsheets and create a workbook or open an existing Excel file.
  2. 2. Enter the data: Enter observed Y values in A2:A4 and their mean in B2. Alternatively, enter =AVERAGE(A2:A4) in B2.
  3. 3. Calculate the result: Select an empty cell, enter =SUMPRODUCT((A2:A4-$B$2)^2), and press Enter.
  4. 4. Save the workbook: Choose File > Save As and select XLSX if you want to share the workbook in Excel format.
Calculate squared differences with SUMPRODUCTOpen and save Microsoft Excel XLSX filesWork in a familiar, easy-to-use spreadsheet interfaceUse WPS Office for free
microsoft office alternative - wps office

Frequently Asked Questions

What formula calculates RSS from observed and predicted values?

If observed values are in A2:A4 and matching predictions are in B2:B4, enter =SUMXMY2(A2:A4,B2:B4) in an empty cell.

Can I calculate the sum of squared deviations from the mean?

Yes. Enter =DEVSQ(A2:A4) in an empty cell to calculate the sum of squared deviations from the mean of those values.

How do I combine results for several groups?

Calculate the sum of squared differences for each group using its own mean or predictions, then use SUM on the cells containing the group results.

Is the sum of squared deviations from the mean always regression RSS?

No. It is regression RSS only when the mean is the prediction used for each observation. Otherwise, use the model's predicted values in the calculation.