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

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!