SUMX2MY2 in ONLYOFFICE: Sum of Differences of Squares
Use ONLYOFFICE SUMX2MY2 to compare the squared magnitudes of two equally shaped numeric ranges, with worked signed examples and caveats.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: =SUMX2MY2(A2:A6,B2:B6) has the independently expected result -6 for the five pairs below. It sums x²−y², which can be negative. It does not sum (x−y)², which gives 58 for this dataset.
Availability and version history
- Introduced: The original introduction release and date are not established by the checked sources.
- Availability: Currently documented in ONLYOFFICE’s rolling function help; no final supported-version endpoint is established.
- Scope: Shared Spreadsheet Editor documentation. Exact historical availability and parity across individual Docs, Desktop and mobile builds remain unverified.
- Checked: October 14, 2026, against the official SUMX2MY2 reference. Formula meanings and example outputs were independently checked; no native test of these cases was performed.
Syntax and range shape
=SUMX2MY2(array_x, array_y)
Both arguments are required. The official reference requires the second range to have the same number of rows and columns as the first. A five-row column and a five-column row do not satisfy that documented shape requirement merely because both contain five cells.
The order matters: the first range supplies the squared values being added and the second the squared values being subtracted. The short entry does not define a complete blank/text policy or exact shape-error token, so the examples use equally shaped numeric ranges.
Complete original five-pair worksheet
Create a blank sheet named PairedSquares. Put x, y, Difference of squares, Sum of squares and Squared difference in A1:E1. Enter only the A/B input values first:
| Row | A: x | B: y | Expected C: x²−y² | Expected D: x²+y² | Expected E: (x−y)² |
|---|---|---|---|---|---|
| 2 | 2 | 1 | 3 | 5 | 1 |
| 3 | -3 | 4 | -7 | 25 | 49 |
| 4 | 0 | -2 | -4 | 4 | 4 |
| 5 | 5 | 5 | 0 | 50 | 0 |
| 6 | 1.5 | -0.5 | 2 | 2.5 | 4 |
Enter =A2^2-B2^2 in C2, =A2^2+B2^2 in D2 and =(A2-B2)^2 in E2. Fill C2:E2 through row 6. In C8, D8 and E8 enter =SUM(C2:C6), =SUM(D2:D6) and =SUM(E2:E6). Expected totals are -6, 86.5 and 58, respectively.
All five pairs are numeric and complete. This makes the three operations directly comparable without relying on undocumented handling of missing or text values.
Function results and independent checks
Use G for labels and H for these results. Keep the original A:E area unchanged.
| Cell | Formula | Expected result |
|---|---|---|
| H2 | =SUMX2MY2(A2:A6,B2:B6) |
-6 |
| H3 | =SUMX2MY2(B2:B6,A2:A6) |
6 |
| H4 | =SUMX2MY2(A2:A3,B2:B3) |
-4 |
| H5 | =SUMX2MY2(A4:A6,B4:B6) |
-2 |
| H6 | =SUMX2MY2(A2:A6,A2:A6) |
0 |
| H7 | =SUMX2MY2(A2:A6,B2:B6)/COUNT(A2:A6) |
-1.2 |
| H8 | =SUMX2MY2(A2:A6,B2:B6)+SUMX2MY2(B2:B6,A2:A6) |
0 |
| H9 | =SUMX2MY2(A2:A6,B2:B6)+SUMX2PY2(A2:A6,B2:B6) |
80.5 |
| H10 | =SUMSQ(A2:A6)-SUMSQ(B2:B6) |
-6 |
The partial sums -4 and -2 add back to -6. Swapping arrays reverses the sign, while comparing an array with itself yields zero. H9 equals twice the x sum of squares: 2×40.25=80.5. These controls preserve every original formula while assigning a distinct output cell.
Advanced: compare squared signal magnitudes
For a pair of equally sampled numeric sequences, the x sum of squares is 40.25 and the y sum is 46.25. Put =SUMSQ(A2:A6) in K2 and =SUMSQ(B2:B6) in K3 to inspect those totals separately.
The difference -6 indicates that y has the greater total squared magnitude. Dividing by the five complete pairs produces -1.2, the mean signed difference in squared magnitude. It is not a mean squared error between the sequences.
A physical energy interpretation can require sampling intervals, calibration and unit factors. The example reports the mathematical squared-magnitude difference rather than silently assuming those factors are one.
Cancellation does not imply identical sequences
On a separate sheet named Cancellation, put x and y in A1:B1. Enter 3,4 in A2:B2 and 4,3 in A3:B3.
Enter =SUMX2MY2(A2:A3,B2:B3) in D2; expect 0 because 9−16 and 16−9 cancel. In D3 enter =SUMXMY2(A2:A3,B2:B3); expect 2, because (-1)²+1²=2. Equal total squared magnitudes do not mean that the corresponding values agree.
This makes SUMX2MY2 unsuitable as a nonnegative discrepancy score: positive and negative row contributions can cancel. Use the function matching the intended comparison.
Troubleshooting and related functions
Check the placement of the 2 in the function name, the order of the ranges and their row/column dimensions. A negative result is legitimate here; it is not a reason to wrap the result in SQRT or replace it with its absolute value without considering the meaning.
Do not transfer SUMPRODUCT’s documented nonnumeric treatment to this different function. Prepare complete numeric pairs, retain the original observations, and keep full precision through sums. Exact malformed-input errors, mixed-type filtering and extreme-value behavior are outside the short reference’s verified scope.
SUMSQ gives each separate sum of squares. SUMX2PY2 adds them, while SUMXMY2 measures squared paired differences. COUNT is a suitable denominator only for the fully paired numeric sample used here, not an automatic missing-data reconciliation.
The examples use English formula names and comma separators. Check the formula-language and regional settings for your installation rather than assuming imported text or another program’s locale rules will behave identically.