Explanation

The length of a line can be calculated with the distance formula, which looks like this:

Distance is the square root of the change in x squared plus the change in y squared, where two points are given in the form (x 1 , y 1 ) and (x 2 , y 2 ). The distance formula is an example of the Pythagorean Theorem applied, where the change in x and the change in y correspond to the two sides of a right triangle, and the hypotenuse is the distance being computed.

In Excel, the distance formula can be written with the exponent operator (^) and the SQRT function like this:

=SQRT((D5-B5)^2+(E5-C5)^2)

Following Excel’s order of operations , the change in x and the change in y is calculated, then squared, and the two results are added together and delivered to the SQRT function, which returns the square root of the sum as a final result:

=SQRT((D5-B5)^2+(E5-C5)^2)
=SQRT((6)^2+(8)^2)
=SQRT(36+64)
=SQRT(100)
=10

The POWER function can also be used instead of the exponent operator (^) like this:

=SQRT(POWER(D5-B5,2)+POWER(E5-C5,2))

with the same result.

Explanation

The Pythagorean theorem is a key principle in Euclidean geometry. It states that the square of the longest side of a right triangle (the hypotenuse) is equal to the sum of the squares of the other two sides. The theorem is written as an equation like this:

a 2 + b 2 = c 2

When any two sides are know, this equation can be used to solve for the third side. When a and b are known, the length of the hypotenuse can be calculated with:

When b and c are known, the length of side a can be calculated with:

When a and c are known, length of side b can be calculated with:

To translate the above into Excel formula syntax, use the exponentiation operator (^) and the SQRT function , as seen below. The Pythagorean theorem can be written as:

=a^2+b^2=c^2 // Pythagorean theorem

And the formulas below can be used to solve for each of the three sides:

c=SQRT(a^2+b^2) // hypotenuse
a=SQRT(c^2-b^2) // side a
b=SQRT(c^2-a^2) // side b

Instead of the exponentiation operator, you can also use the POWER function like this:

c=SQRT(POWER(a,2)+POWER(b,2))
a=SQRT(POWER(c,2)-POWER(b,2))
b=SQRT(POWER(c,2)-POWER(a,2))

The formulas above are an example of nesting one function inside another.