SUMXMY2 function in Google Sheets
Calculates the sum of the squares of differences of values in two arrays.
=SUMXMY2(array_x, array_y)SUMXMY2 syntax and parameters
Two arguments, two required.
- array_xarrayRequired
The array or range of values that will be reduced by corresponding entries in array_y, squared, and added together.
- array_yarrayRequired
The array or range of values that will be subtracted from corresponding entries in array_x, the result squared, and all such results added together.
SUMXMY2 examples
Formulas you'll actually reuse.
Sum of squared differences — the core of a least-squares fit:
=SUMXMY2(B2:B50, C2:C50)Result
58240Root-mean-square error between forecast and actual:
=SQRT(SUMXMY2(B2:B50, C2:C50) / ROWS(B2:B50))Result
34.5
SUMXMY2 in Excel
Same name — your formula ports as-is.
Try SUMXMY2 in the playground
Edit the example — nothing to install.
Preloaded with the SUMXMY2 formula from Example 1 — change anything and watch it respond.
SUMXMY2 errors
What they mean — and the fixes.
#N/AThe two arrays have different numbers of values.
Related functions
More ways Google Sheets gets this done.
- CHOOSECOLSCreates a new array from the selected columns in the existing range.ArrayExcel
- CHOOSEROWSCreates a new array from the selected rows in the existing range.ArrayExcel
- HSTACKAppends ranges horizontally and in sequence to return a larger array.ArrayExcel
- LINESTGiven partial data about a linear trend, calculates various parameters about the ideal linear trend using the least-squares method.ArrayExcel
- MDETERMReturns the matrix determinant of a square matrix specified as an array or range.ArrayExcel
- MINVERSEReturns the multiplicative inverse of a square matrix specified as an array or range.ArrayExcel