Applies ToExcel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2024 Excel 2024 for Mac Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2016

This article describes the formula syntax and usage of the SUMX2MY2  function in Microsoft Excel.

Description

This Excel function returns the sum of the difference of the squares of corresponding values in two arrays. 

Syntax

SUMX2MY2(array_x, array_y)

The SUMX2MY2 function syntax has the following arguments:

  • array_x    Required. The first array or range of values.

  • array_y    Required. The second array or range of values.

Remarks

  • The arguments should be either > numbers or > names, arrays, or references that contain numbers.

  • If an array or reference argument contains text, logical values, or empty cells, those values are ignored. However, cells with the value zero are included. 

  • If array_x and array_y have a different number of values, the SUMX2MY2 function returns the #N/A error value. 

  • The equation for the sum of the difference of squares is:

    Equation

Example

Copy the example content in the following table (including the formula rows) and paste in cell A1 of a new Excel worksheet. If the formulas do not automatically show results, you can select then press F2 and press Enter. Adjust column widths as needed to see all of the data. 

Data

First array

Second array

2

6

3

5

9

11

1

7

8

5

7

4

5

4

Formula

Description (Result)

Result

=SUMX2MY2(A2:A8,B2:B8)

Sum of the difference of squares of the two arrays above (-55)

-55

=SUMX2MY2({2, 3, 9, 1, 8, 7, 5}, {6, 5, 11, 7, 5, 4, 4})

Sum of the difference of squares of the two arrays constants (-55)

-55

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.