SUMX2MY2 Function
Returns the sum of the differences of squares of two arrays (Σ x² − y²).
Category
Math & Trig
Available in
All versions, Microsoft 365
Returns
A number
Want to practice SUMX2MY2 in a real spreadsheet? Open a blank sheet in our Practice Sandbox and try it with live data, with the AI Excel tutor beside you. No Excel needed — just a free account.Try it free in the Sandbox
Overview
SUMX2MY2 squares each pair of matching values, subtracts the second square from the first, and adds the results.
It's mainly found in statistics and engineering formulas.
Syntax
=SUMX2MY2(array_x, array_y) Explain
Arguments
| Argument | Required? | What it does |
|---|---|---|
| array_x | Yes | The first range. |
| array_y | Yes | The second range, same size. |
Examples
Example 1 — x² − y² for each pair
(2² − 1²) + (3² − 2²) + (4² − 3²).
C2fx=SUMX2MY2(A2:A4, B2:B4)
| A | B | C | |
|---|---|---|---|
| 1 | x | y | Result |
| 2 | 2 | 1 | 15 |
| 3 | 3 | 2 | |
| 4 | 4 | 3 |
=SUMX2MY2(A2:A4, B2:B4) Explain
Common mistakes
- Different sizes. Return #N/A.
Notes
- Same as =SUMPRODUCT(A2:A4^2 - B2:B4^2).
- Related functions: SUMX2PY2, SUMXMY2, SUMSQ.

Author
Kyle Stott
Certified Microsoft Excel Expert
Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.