Example 1
Sum of two squares
C2 =SUMSQ(A2,B2)
Result: 25
3 squared is 9 and 4 squared is 16.
C2 =SUMSQ(A2,B2) returns 25
Returns the sum of the squares of the numbers you give it. SUMSQ(3, 4) is 25. It is the building block for distances and error measures.
Syntax
=SUMSQ(, [number2], …)
All versions of Excel.
Try it
Edit the formula in C2 or change the inputs. The sheet recalculates as you type.
C2 =SUMSQ(A2,B2) returns 25
SUMSQ squares each number and adds the results. =SUMSQ(3, 4) is 9 + 16 = 25, and =SUMSQ(B2:B6) squares and adds every number in the range. It saves writing a helper column of squares and a SUM under it.
The straight-line distance between two points uses SUMSQ naturally: =SQRT(SUMSQ(3, 4)) is 5. With the x gap in one cell and the y gap in another, =SQRT(SUMSQ(G2-E2, H2-F2)) gives the distance without writing each square.
Squaring errors makes every error positive and punishes large misses more than small ones. SUMSQ of a column of errors is the sum of squared errors. Divide by the count and take the root to get the root mean square error:
=SQRT(SUMSQ(B2:B6)/COUNT(B2:B6))
This is a standard accuracy measure for forecasts. A forecast that is wrong by 10 once scores worse than one that is wrong by 2 five times, which matches how most people judge a miss.
With a calculation inside, SUMSQ gives the total of squared deviations from the mean: =SUMSQ(B2:B6-AVERAGE(B2:B6)). In Microsoft 365 this works as an ordinary formula. In older versions it needs Ctrl+Shift+Enter. DEVSQ does the same job in one function and is the cleaner choice.
Within a range or a cell reference, text, TRUE/FALSE and empty cells are ignored. Values typed straight into the formula are used, so =SUMSQ("3", 4) is 25. Errors in a range pass through.
=SUMPRODUCT(B2:B6, B2:B6), gives the same answer as SUMSQ.Because negative numbers square to positive ones, SUMSQ(-3, 4) is also 25. The sign of an error is lost, which is deliberate when you only care about its size.
B2:B9.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
C2 =SUMSQ(A2,B2)
Result: 25
3 squared is 9 and 4 squared is 16.
C2 =SUMSQ(A2,B2) returns 25
Example 2
C2 =SUMSQ(A2:A4)
Result: 14
1 + 4 + 9.
C2 =SUMSQ(A2:A4) returns 14
Example 3
C2 =SQRT(SUMSQ(A2,B2))
Result: 5
SUMSQ gives 25 and SQRT takes the root.
C2 =SQRT(SUMSQ(A2,B2)) returns 5
Example 4
C2 =SUMSQ(A2:A6-AVERAGE(A2:A6))
Result: 40
The mean is 6, and the deviations -4, -2, 0, 2 and 4 square to 16, 4, 0, 4 and 16. DEVSQ gives the same result.
C2 =SUMSQ(A2:A6-AVERAGE(A2:A6)) returns 40
Example 5
B7 =ROUND(SQRT(SUMSQ(A2:A5)/COUNT(A2:A5)),2)
Result: 3.16
The squared errors add to 40. Divided by 4 that is 10, and its square root is 3.16. The signs cancel out, so over- and under-forecasts both count.
B7 =ROUND(SQRT(SUMSQ(A2:A5)/COUNT(A2:A5)),2) returns 3.16
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In B8, return the sum of the squares of the five forecast errors.
Answer in B8.
A2:A6-AVERAGE(A2:A6), needs Ctrl+Shift+Enter before Microsoft 365. DEVSQ avoids that for deviations.It squares each number and adds the squares. SUMSQ(3, 4) is 25.
Use `=SQRT(SUMSQ(errors)/COUNT(errors))`. It squares the errors, averages them and takes the root.
For one range they give the same answer: `SUMSQ(B2:B9)` equals `SUMPRODUCT(B2:B9, B2:B9)`. SUMSQ is shorter. SUMPRODUCT can multiply different ranges.
In a range or cell reference, yes: text, TRUE/FALSE and blanks are skipped. Numbers typed directly into the formula are used.
Use `=SQRT(SUMSQ(x2-x1, y2-y1))`. SUMSQ adds the squared gaps and SQRT takes the root.
Tracks take you from the basics to modelling, one graded exercise at a time.