# Calulating a point on a line

C

#### Curbie

I'm trying to calculate some steps or stages for a graph and am having
trouble, basically I'm trying to calculate a line between a point x,y
to a point on a line between x1,y1 and x2,y2 that looks some like
this:

.x2,y2(8,6)
/
/-----------------------------------x,y(13,3)
/
.x1,y1(1,1)

I think I got the slope 5/7=0.7142857, but I'm looking for the
equation to calculate line between a point x,y to a point on a line
between x1,y1 and x2,y.

Go easy on me, I haven't been to school in 35 years.

J

#### joeu2004

Curbie said:
I'm trying to calculate some steps or stages for
a graph and am having trouble, basically I'm trying
to calculate a line between a point x,y to a point
on a line between x1,y1 and x2,y2

If X1:X2 contains 1 and 8 (x1 and x2) and Y1:Y2 contains 1 and 6 (y1 and
y2), you can compute:

Z1: =SLOPE(Y1:Y2,X1:X2)
Z2: =INTERCEPT(Y1:Y2,X1:X2

Then for any X (in X3), the corresponding Y is:

=Z1*X3+Z2

Or more simply:

=FORECAST(X3,Y1:Y2,X1:X2)

C

#### Curbie

Joe,

Oh cool, I didn't realize Excel had built-in SLOPE, INTERCEPT, and
FORECAST functions, I was calculating them with VBA, slope = (y2 - y1)
/ (x2 - x1) and intercept =m(x - x1) + y1

Thanks for your time and help.