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 SUMXMY2 function in Microsoft Excel. 

Description

The SUMXMY2 function returns the sum of squares of differences of corresponding values in two arrays.

Syntax

SUMXMY2(array_x, array_y)

The SUMXMY2 function syntax has the following arguments:

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

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

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 do not have the same number of values, SUMXMY2 returns the #N/A error value.

  • The equation for the sum of squared differences is:

    Equation

Example

Copy the example content in the following table and paste it in cell A1 of a new Excel worksheet. If the formula does not automatically show results, select them, press F2, then press Enter. You may prefer to adjust column widths to more easily see all 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

=SUMXMY2(A3:A9,B3:B9)

Sum of squares of differences of the two arrays above (79)

79

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

Sum of squares of differences of the two arrays constants (79)

79

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.