![](https://codky.com/wp-content/uploads/2024/11/13357-1024x576.png)
The `SUMX2MY2` function in Excel is used to calculate the sum of the difference between the squares of corresponding values in two arrays. Essentially, it computes:
[ sum (x^2 – y^2) ]
Where ( x ) and ( y ) are corresponding values in two given arrays.
Syntax:
SUMX2MY2(array_x, array_y)
- array_x: The first array or range of numbers.
- array_y: The second array or range of numbers.
Steps to Use `SUMX2MY2` Function:
=SUMX2MY2(A1:A5, B1:B5)
- Prepare Your Data:
- Arrange the data in two separate columns or rows. Ensure that both arrays (ranges) have the same number of elements.
- Enter the Function:
- Click on the cell where you want the result to appear.
- Enter the formula using the syntax mentioned above. For example, if your first array is from cell A1 to A5 and the second array is from B1 to B5, the formula will be:
- Press Enter:
- After typing the formula, press `Enter` to get the result.
Example:
Suppose you have two sets of data:
- Array X (values in cells A1 through A5): 2, 3, 4, 5, 6
- Array Y (values in cells B1 through B5): 1, 2, 3, 4, 5
In cell C1, enter:
=SUMX2MY2(A1:A5, B1:B5)
Calculation:
- ((2^2 – 1^2) = 3)
- ((3^2 – 2^2) = 5)
- ((4^2 – 3^2) = 7)
- ((5^2 – 4^2) = 9)
- ((6^2 – 5^2) = 11)
Sum of these results: (3 + 5 + 7 + 9 + 11 = 35)
The function would return `35` in cell C1. This is the sum of differences between the squares of corresponding elements in the two arrays. Ensure both arrays are of the same length; otherwise, Excel will return a `#VALUE!` error.