View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
LESLIE LESLIE is offline
external usenet poster
 
Posts: 113
Default intersection of two lines defined by points

Thanks for the quick response. However, I cannot lump all data points into
one line equation. X values will be in ascending order but not all points
fall within one single line equation. And yes, I also need it to extrapolate
assuming a linear behavior of the last two points of that extrapolation
location. Example points:
x1 y1 x2 y2
1 12 1 0
3 11.8 15 8
4 10 22 10
5.2 9
9 8.9
13 8.5
20 8.4

Thanks again!

"Bernie Deitrick" wrote:

Bernard,

That's what I originally thought, too, until I noted

assuming a linear behavior between points


which I took to mean not using the entire data set for the fit.

Perhaps the OP will clarify...

Bernie


"Bernard Liengme" wrote in message
...
Line 1: y=m1x+c1
Line 2: y=m2x+c2

At the point of intersection the y-values of the two lines are the same as are the x-values. So we
write
m1x+c1=m2x+c2
This gives (m1-m2)x=c2-c1 or x = (m1-m2)/(c2-c1)
and
y = m1*(m1-m2)/(c2-c1) + c1
In Excel, we can find x with
=(SLOPE(y-values-dataset1,x-values-dataset1 -SLOPE(y-values-dataset2,x-values-dataset2)) /
(INTERCEPT(y-values-dataset2,x-values-dataset2) - INTERCEPT(y-values-dataset1,x-values-dataset1))
In this is in cell G1, then we find y with
=SLOPE(y-values-dataset1,x-values-dataset1)*G1 + INTERCEPT(y-values-dataset1,x-values-dataset1

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Leslie" wrote in message
...
I am looking for either a worksheet function or VBA code that would give me
the x and y coordinates of the intersection of two lines defined by points. I
have a list of x's and y's for one data set and a list of x's and y's for
another data set. I need the intersection (x and y) of these two sets of data
assuming a linear behavior between points. Your help woiuld be greatly
appreciated. Thanks!