# SUMXMY2 Function

> Return the sum of the squared differences of two arrays with SUMXMY2 in TX Sheet Control: how pairs are calculated, the #VALUE! error and an example.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Function
- **Path:** TX Sheet Control > API Reference > Formula Functions > SUMXMY2 Function
- **192 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/sumxmy2/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/sumxmy2/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/sumxmy2/llms-full.txt

---

Return the sum of the squares of the differences of corresponding values in two arrays. For each pair of values, SUMXMY2 squares the difference of the value in `array1` and the value in `array2`, and adds the squares. Arrays of different sizes return `#VALUE!`.

### Syntax

```text
SUMXMY2(array1, array2)
```

Category: Math. Minimum arguments: 2. Maximum arguments: 2.

Available for supported offline calculation.

### Examples

```text
=SUMXMY2({1,2},{3,4})
```

The formula returns 8, which is (1 − 3)² + (2 − 4)².

Cell and range examples require appropriate input values in the referenced cells. Handle invalid arguments, formula errors and array and spill constraints.

### See Also

- [Formulas](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/formulas/llms-full.txt)
- [Custom Functions and Formula Data](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/custom-functions/llms-full.txt)

---

## Nearby

- **Previous:** [SUMX2PY2 Function](https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/sumx2py2/llms-full.txt)
- **Next:** [SWITCH Function](https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/switch/llms-full.txt)
