Contact

SUMXMY2 Function in Apple Numbers: Sum of Squared Differences

Numeric Intermediate Apple Numbers

Use SUMXMY2 to calculate squared differences between aligned measurements in Apple Numbers, with worked examples and validation.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

SUMXMY2 subtracts each pair of corresponding numbers, squares each difference and adds the squares. Apple’s six-pair example gives 196.

This is useful for squared prediction errors or distances between matched numeric vectors. Pairing matters, and the output is not an average until an appropriate denominator is supplied.

Availability and version history

  • Introduced: The original introduction release and date are not established by the checked references.
  • Availability: Currently documented in Apple’s Functions Help 15.4 documentation edition; no final supported-version endpoint is established.
  • Scope: Shared iWork reference. Function-specific historical Mac, iPad, iPhone and iCloud availability is unverified.
  • Checked: October 14, 2026, against the official SUMXMY2 reference. Worked results were independently calculated; no native Numbers test was performed.

Syntax and numeric collections

SUMXMY2(set-1-values, set-2-values)

The official SUMXMY2 reference requires two collections containing number values. It does not provide an optional third argument or an omitted-input default. Use equal-length numeric ranges for the examples; the short entry does not specify an error token for every malformed collection.

Reproduce the complete six-pair source example

Create VendorPairs, with ten columns A:J and ten rows, using no header rows. Enter Apple’s exact values in A1:B6. In C1 enter =(A1-B1)^2 and fill through C6:

Row A B Expected C
1 2 7 25
2 9 5 16
3 3 6 9
4 11 8 9
5 1 12 121
6 5 9 16

Put these formulas in E1:E6, keeping them outside the two input columns:

Cell Formula Expected result
E1 =SUMXMY2(A1:A6,B1:B6) 196
E2 =SUM(C1:C6) 196
E3 =SUMX2PY2(A1:A6,B1:B6)-2*SUMPRODUCT(A1:A6,B1:B6) 196
E4 =SUMSQ(A1:A6) 241
E5 =SUMSQ(B1:B6) 399
E6 =SUMPRODUCT(A1:A6,B1:B6) 222

E2 exposes the row contributions. E3 gives an independently derived identity for the same complete numeric inputs. The 241,399 and 222 controls are useful for distinguishing the three similarly named functions; they are not interchangeable outputs.

Two separate small numeric checks

Create SmallPairs and SignedPairs, each with eight columns A:H and six rows, using no header rows. In SmallPairs, enter 1,2,3 in A1:A3 and 4,5,6 in B1:B3. In SignedPairs, enter 1,0,-2 in A1:A3 and 0,-2,3 in B1:B3.

In D1 of each table enter =SUMXMY2(A1:A3,B1:B3). The expected results are 27 in SmallPairs and 30 in SignedPairs. Put =(A1-B1)^2 in C1 and fill through C3, then =SUM(C1:C3) in D2 to check the total.

Use the original VendorPairs table for the six-pair example rather than overwriting these smaller fixtures.

Advanced: squared error, average error and signed bias

In SmallPairs, regard A as actual values and B as predictions. Every prediction exceeds the actual value by three, so each squared error is nine and the total is 27.

Use E1:E5 for the following controls:

Cell Formula Expected result
E1 =SUMXMY2(B1:B3,A1:A3) 27
E2 =D1/3 9
E3 =SQRT(E2) 3
E4 =(SUM(A1:A3)-SUM(B1:B3))/3 -3
E5 =SUMX2PY2(A1:A3,B1:B3)-2*SUMPRODUCT(A1:A3,B1:B3) 27

E2 is mean squared error and E3 is root-mean-squared error. E4 is signed mean error using actual minus predicted. Its sign is not present in the squared-error total. The denominator three is valid here because there are exactly three complete numeric pairs; it is not an automatic count of valid rows in arbitrary data.

Swapping actual and predicted leaves the squared total unchanged but would reverse signed mean error. RMSE has the original measurement units, while SSE and MSE have squared units.

Zero mean error does not mean accurate predictions

Copy SmallPairs to BalancedErrors. Replace only B1:B3 with 0,4,2. The actual values remain 1,2,3. C becomes 1,4,1, so D1, D2, E1 and E5 become 6.

E2 becomes 2, E3 becomes approximately 1.4142135624, and E4 becomes 0. The signed errors 1,-2,1 cancel, but their squares do not. A bias check alone can therefore miss substantial individual errors.

In G1 enter =A1-B1 and fill through G3. H1 =SUM(G1:G3) gives 0, while H2 =SUMSQ(G1:G3) gives 6, exposing the distinction without relying on a summary label.

Changing only one collection changes the pairings

Make a separate copy of the original SmallPairs named ReorderedPredictions. Replace B1:B3 with 6,5,4, leaving A as 1,2,3. The two collections contain the same values as before but in different pairings.

C becomes 25,9,1, and D1 becomes 35 instead of 27. E4 remains -3, because each column’s sum is unchanged. Thus equal column totals and equal signed mean error do not establish the same squared prediction error.

Make another fresh copy of the original SmallPairs named ShiftedPredictions. Replace A with 11,12,13 and B with 14,15,16. Both collections have moved by ten, leaving each difference unchanged; D1 remains 27, E2 remains 9 and E3 remains 3. A common shift is different from a mismatched record order.

Numeric inputs, references and practical limits

Use genuine numeric cells in these exercises. The short main-function entry does not supply a complete rule for text, Boolean, blank, date, duration or error-valued inputs. Do not transfer a helper function’s type rules, or another spreadsheet’s rules, into this function without evidence. Unequal collections and exact error tokens also remain outside the paired examples.

Keep corresponding observations and their identifiers together. The fixtures use equal-length, complete numeric ranges; inserting zero for an unknown observation changes the mathematical question. Very large inputs are squared, so finite-precision and magnitude limits matter, but the checked entry does not quantify them.

Within the same Numbers table, the shown cell references are sufficient. For another table, use the reference picker or a qualified form such as TableName::A1:A6. English examples use comma separators; Apple’s functions overview specifies semicolons between arguments when the decimal separator is a comma. Matching English function names do not establish identical historical support, coercion or import behavior across products.

SUMSQ can sum the explicit residual squares. SUMX2PY2 and SUMPRODUCT reconstruct the cross-term identity, while SUMX2MY2 computes a different signed quantity. SQRT converts mean squared error to RMSE.