Sum of Squares with SUMSQ

Excel Formulas › Math

All versionsSUMSQ

Square every value and add them up — the basis of variance, distance, and least-squares math. SUMSQ does it in one function, no helper column of squares.


Quick formula: sum of squares of B2:B100:
=SUMSQ(B2:B100)
Each value squared, then totaled. SUMSQ(3,4) = 9 + 16 = 25.

Functions used (tap for the full reference guide):

The example

3 and 4 → 9 + 16 = 25.

AB
1ValuesSum of squares
23, 425

The formula

The formula:

=SUMSQ(B2:B100) // Σ value²

How it works

How it works:

  1. SUMSQ(range) squares each value and sums the results.
  2. It’s the engine behind variance, Euclidean distance, and least-squares fitting.
  3. Equivalent to SUMPRODUCT(range, range) or SUM(range^2) (the latter as an array).
  4. For the distance between two points, square the differences: =SQRT(SUMSQ(x2-x1, y2-y1)).

Sum of squared errors — the heart of regression — is SUMSQ(actual − predicted) as an array, or SUMPRODUCT((actual-predicted)^2). SUMSQ keeps these formulas short and readable.

Try it: interactive demo

Live demo

Values.

Sum of squares:

Variations

Euclidean distance

Between two points:

=SQRT(SUMSQ(x2-x1, y2-y1))

SUMPRODUCT version

Same result:

=SUMPRODUCT(rng, rng)

Sum of squared errors

Regression:

=SUMPRODUCT((actual-pred)^2)

Pitfalls & errors

Text is ignored. SUMSQ skips text and blanks — keep the range numeric.

Squares grow fast. Large values produce very large sums; watch for scale.

Not the same as (sum)². Sum of squares ≠ square of the sum.

Practice workbook

📊
Download the free Sum of Squares with SUMSQ practice workbook
A SUMSQ sheet with the distance, SUMPRODUCT, and squared-errors variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I sum the squares of values in Excel?
Use =SUMSQ(range). It squares each value and adds them, e.g. SUMSQ(3,4)=25.
How do I calculate distance between two points?
Use =SQRT(SUMSQ(x2-x1, y2-y1)) for the Euclidean distance.
Is SUMSQ the same as squaring the sum?
No — SUMSQ sums the individual squares; (sum)² squares the total. They're different.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: SUMPRODUCT formula · Euclidean distance · Standard deviation

Function references: SUMSQ