
In this article
SUMXMY2 returns Σ(x – y)²: the squared error between forecasts and actuals.
Advertisement
Syntax
=SUMXMY2(array_x, array_y)
| Argument | What it means |
|---|---|
array_x, array_y |
Same-size ranges |
Examples
Example 1
=SUMXMY2(CHOOSE(A2,{100,120,130},{1,2,3},{5,5}),CHOOSE(A2,{98,125,128},{1,1,1},{3,4}))
Result: 33. See the worked example table below for more cases.
SUMXMY2 in practice
Where you will use it
- Forecast error (sum of squared errors)
- Distance between two vectors
- Model fitting
Worked example
| Case | Formula | Result |
|---|---|---|
| 1 | =SUMXMY2(CHOOSE(A2,{100,120,130},{1,2,3},{5,5}),CHOOSE(A2,{98,125,128},{1,1,1},{3,4})) | 33 |
| 2 | =SUMXMY2(CHOOSE(A3,{100,120,130},{1,2,3},{5,5}),CHOOSE(A3,{98,125,128},{1,1,1},{3,4})) | 5 |
| 3 | =SUMXMY2(CHOOSE(A4,{100,120,130},{1,2,3},{5,5}),CHOOSE(A4,{98,125,128},{1,1,1},{3,4})) | 5 |
Results calculated in Excel.
Mistakes people make
| Mistake | What to do instead |
|---|---|
| Different sizes | #N/A |
| Want RMSE | SQRT(SUMXMY2(a,f)/COUNT(a)) |
Related functions
📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.
Advertisement
✨ Ask AI about this article
Stuck on a step? Ask a question and the AI answers using this article.
Free · AI can be wrong