Compare Two Grid Positions with Excel SUMSQ
If two objects on a square grid sit at different distances from the same reference point, Excel’s SUMSQ function can tell you which is farther. Put the horizontal and vertical offsets in adjacent cells and use =SUMSQ(B2:C2). The result adds the square of each offset. You can compare the results directly, or take the square root to express the distance in grid units. In this example, an offset of 3 across and 4 up gives 25 square units in the calculation and a straight-line distance of 5 units.
Set up a fair comparison
Imagine a tabletop plan for a community exhibition. A supply station sits at the marked origin, and you want to tell which of two signs is closer on the plan. Each square on the plan represents the same length in both directions. Use a positive number for a move to the right or up, and a negative number for a move to the left or down. Work in the same unit throughout. If you measured the two axes in different units, convert one before drawing a conclusion.
In a blank worksheet, label A1 Station, B1 Across, C1 Up, D1 Squared distance, and E1 Distance. Enter Oak in A2, 3 in B2, and 4 in C2. Enter Pine in A3, -5 in B3, and 2 in C3. For a control row, enter Origin in A4 and 0 in both B4 and C4. Type each offset as a number. Putting a unit abbreviation inside an offset cell would make it text, so put the unit in a heading or a nearby note instead.
Enter =SUMSQ(B2:C2) in D2 and fill it down through D4. You should see 25 for Oak, 29 for Pine, and 0 for Origin. A quick pencil check confirms the Pine result. Five squared is 25 and two squared is 4, so the total is 29 even though the horizontal coordinate has a minus sign. The sign determines where you draw the point. Squaring removes the sign from the size of that component.
Decide which number to present
If the sole question is which sign lies closer, compare 25 and 29. Oak is closer because the square root of a larger nonnegative number is also larger. For a reader who wants the measured distance, enter =SQRT(D2) in E2 and fill down. Oak gives 5. Pine gives about 5.385. Format the distance column to two decimal places for display, so the reader sees 5.00 and 5.39 while the underlying calculation retains its precision.
The result in D has squared units. If every grid square represents one metre in both directions, the result in E has metres. Keep those meanings visible whenever you copy results into a report. Also consider what your plan represents. For a supply cart that has to travel around a table, a straight-line measure cannot tell you how far the cart will roll. You can keep this worksheet as a comparison of positions and measure the actual route separately.
Catch missing and mistyped offsets
Microsoft’s SUMSQ reference distinguishes between values typed directly in the argument list and values in a worksheet range. When you pass a range such as B2:C2, text in those cells can escape the calculation. Try replacing the numeric 4 in C2 with an apostrophe followed by 4, which enters it as text. The range formula can then return 9, a plausible-looking result for the wrong point. Undo the edit after you see the change.
For a reusable sheet, use =IF(COUNT(B2:C2)=2,SUMSQ(B2:C2),"Check offsets") in D2. It expects two numeric cells and gives you an explicit message when one value is missing or entered as text. If you use that guard, change the distance formula to =IF(ISNUMBER(D2),SQRT(D2),"") so a missing input leaves the distance display empty. Enter 0 when an offset is genuinely zero. A blank means the input still needs a decision.
Another common error is applying the square after adding the coordinates. For Oak, (3+4)^2 gives 49, which includes a cross term that has no role in this grid measurement. SUMSQ squares first. If you need to explain the formula to someone, verify a row using =B2^2+C2^2 and compare the result with column D.
Move the origin and check your reasoning
Suppose the supply station changes from the origin to grid position (1, 1) and columns B and C now hold absolute positions. The horizontal and vertical offsets for Oak become 2 and 3, giving 13. Put 1 in H2 and 1 in I2 to store the supply station coordinates. Try =SUMSQ(B2-$H$2,C2-$I$2) and fill the formula down. The dollar signs keep the station location fixed as the row changes. Treat this as a separate version of the example. The earlier input guard checked the two point cells only, so extend it to cover H2 and I2 if you intend to share this variant.
Microsoft lists SUMSQ for current subscription desktop releases and several perpetual Excel releases. If your installation uses localized function names or a semicolon as the argument separator, follow the syntax Excel shows for your locale. For one last check, place a new sign at (-4, -3) using the original origin. Can a sign on the opposite side of the origin tie Oak? Calculate both squares before checking the worksheet. Both points should give 25, which shows how different locations can have the same distance.
Sources and related reading
Microsoft’s SUMSQ function reference
Check whether a workbook cell contains a formula with ISFORMULA














