Excel has a dedicated function: =SUMSQ(A1:A10) squares every number in the range and adds the results, so 25 and 25 return 1250. It accepts up to 255 arguments, so =SUMSQ(A1:A10,C1:C10) works too, and negative numbers come back positive since squaring removes the sign.
For a couple of values you can do it directly with the caret operator — =A1^2+B1^2 or =SUM(A1^2,B1^2) — but that doesn’t scale past a few cells.
For the sum of squared deviations from the mean, which is what “sum of squares” usually means in statistics, use =DEVSQ(A1:A10); it subtracts the average from each value, squares the differences and totals them, saving you a helper column. To square only the rows meeting a condition, =SUMPRODUCT((A1:A10="North")*B1:B10^2) works in every version with a plain Enter.
Let’s say you’re a project manager tracking each team member’s hours on different tasks during a week.
To assess the variability in work hours and better manage workloads, you decide to calculate the sum of squares of deviations from the average hours worked.
In Excel, there is a specific function that you can use to calculate the sum of squares of numbers in a single cell.
This function is called SUMSQ. You can refer to a range of cells or enter values directly into the function to get the result. (For the sum of squares of deviations from the average, Excel has another function, DEVSQ, which I have covered below.)
Formula to Get the Sum of Squares
This function calculates the sum of squares of the values in the range you refer to. It squares each value and then sums them up.

Below are the steps to write this:
- Type (=) in a cell to enter the function.
- Enter SUMSQ and then enter an opening parenthesis.
- Refer to the range where you have the numbers for which you want to get the sum of squares.
- Close the function and hit Enter to get the result.
When you hit Enter, it gives you the final value, the sum of the squares of 25 and 25, as we have two numbers in the range A1:B1.

To verify, we can do a manual check. The square of 25 is 625, and as we have 25 in both cells, it should be 625 + 625 = 1250.
And this is what we have in the result. You can also refer to a range with multiple numbers without worrying about the count of cells.

Note: If you are using negative numbers, you will still get the result as a positive number.
Here’s the formula for the example above. SUMSQ ignores blank cells and text in the range, and you can give it up to 255 numbers or ranges:
=SUMSQ(A1:B1)
Use a Simple Maths Formula
Instead of using the function, you can use a simple formula using the caret operator (^).

=SUM(A1^2,B1^2)
Here we have used the SUM function, and with each number, we have used the caret operator (^) to get the square of that number first. Or you can also write a formula like the following:
=A1^2+B1^2
These methods have limited use. So, if you have a long list of numbers, using the first method is better.
SUM of Square in Excel using Conditions
To calculate the sum of squares using a condition, you can use the SUM function as an array formula (SUMIFS can’t square the values).
Here, I’ll show you how to calculate the sum of squares based on a specific condition.
Let’s say you have sales data in column B and corresponding regions in column A. You want to calculate the sum of squares of sales, but only for the “North” region.
=SUM((B1:B10 * (A1:A10="North"))^2)
In older versions of Excel, you need to enter it by using CTRL+SHIFT+ENTER after typing the formula.
You can enter it normally in newer versions (Excel 365 and Excel 2021), and Excel will handle it as a dynamic array if needed.
If you don’t want to use Ctrl + Shift + Enter in older versions, SUMPRODUCT gives the same result as a normal formula:
=SUMPRODUCT((A1:A10="North")*B1:B10^2)
Sum of Squares of Deviations with DEVSQ
In the example at the start, the project manager wants the sum of squares of deviations from the average, not of the hours themselves. For that, use DEVSQ. It subtracts the average from each value, squares the result and adds them all up:
=DEVSQ(A1:A10)
For example, for 1, 2 and 3, the average is 2, so DEVSQ returns 1 + 0 + 1 = 2, while SUMSQ returns 1 + 4 + 9 = 14.
Frequently Asked Questions
How do I get the sum of squared differences of two columns?
Use SUMXMY2. It subtracts each value in the second range from the matching value in the first range, squares the differences and adds them up:
=SUMXMY2(A1:A10,B1:B10)
Why does SUMSQ ignore some of my numbers?
They are numbers stored as text. In a range, SUMSQ skips text, so convert those cells into numbers first (for example, with VALUE or Text to Columns).
What is the difference between SUMSQ and DEVSQ?
SUMSQ squares the values as they are. DEVSQ first subtracts the average from each value and then squares them, which is what you need for variance and other statistics.
Written by
Puneet Gogia
Microsoft MVP — Excel · Founder, Excel Champs
Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.