+ Reply to Thread
Results 1 to 8 of 8

Finding Intersection between 2 Trend Lines

  1. #1
    Registered User
    Join Date
    12-26-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    23

    Finding Intersection between 2 Trend Lines

    Afternoon,

    I have a graph showing 2 items of data, and I need to calculate the intersection between these 2 sets of data.
    Below is a screen capture of the graph, with the blue series of data shown in the table to the left. Note that the top row is row 1.

    Capture.JPG

    Below is the red series of data, formulated to just show a vertical line.

    Capture 2.JPG

    My end goal is to have excel report the Y value of where these 2 line intersect, in this instance I know the X value will be 49, and the Y will be approx 140. Is this something that is achievable?

    Any assistance greatly appreciated, thanks.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,820

    Re: Finding Intersection between 2 Trend Lines

    Short but useless answer -- yes this is achievable.

    Can you clarify some things -- the blue line looks like it is simply interpolating between points of that series, is that correct? Will the red line always be a vertical line?

    If I have interpreted correctly, and I assume that the red line will always be vertical and the intersection point will always be between the 5th and 6th data point, then I would use a simple TREND() function: =TREND($E$7:$E$8,$D$7:$D$8,$B$22)

    If I cannot be sure that the intersection point will always be between the 5th and 6th point, but could be between any two points, (still assuming red line is always vertical), then I would use a linear interpolation algorithm (mostly a lookup problem) to find the segment that contains the intersection point, then find the y value and red's x value from the slope and intercept for that point. A couple of examples of how I might implement an interpolation algorithm:
    https://www.excelforum.com/excel-for...ml#post4873049
    https://www.excelforum.com/excel-cha...ml#post3904113

    If I cannot assume that the red line will be vertical, then I would perform an interpolation based on both curves, then use solver/goal seek to find the point where interpolation_blue-interpolation_red=0. I'm assuming that there will only be one intersection point for red and blue. If/when it is possible for there to be multiple intersection points, I have to be more careful to be sure it converges on the desired intersection.

    Does that help? What questions do you have in implementing any of these? Have I misunderstood anything?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,618

    Re: Finding Intersection between 2 Trend Lines

    I wouldn't call this trend lines :-) Anyway, you may start with finding which point has first larger or equal X:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Its value (in this case 69.64) will be easy to find with:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and smaller than (12.87) by:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    similar formulas for their respoecive Y values
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    then Y for given X can be found from simple proportion
    Y = y_too_small + (x_too_big - X)/(x_too_big - x_too_small)*(y_too_big - y_too_small)

    so in excel:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    BTW, I hope I've not mismatched any ranges - It's much easier to write such formulas with sample workbook to test them :-) But you attached none
    Last edited by Kaper; 09-10-2018 at 11:45 AM.
    Best Regards,

    Kaper

  4. #4
    Registered User
    Join Date
    12-26-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    23

    Re: Finding Intersection between 2 Trend Lines

    Apologies all, I couldn't attach the original workbook, but I have now extracted what in essence is what I'm after. I've tried to attach it, but if its not attached, could someone give me some pointers!

    Thanks for everyone's input thus far.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-26-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    23

    Re: Finding Intersection between 2 Trend Lines

    As a clarification:
    - They technically aren't trend lines, but hey ho
    - The red series will always be a vertical line, however it may not always fall between 5th & 6th data points

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,820

    Re: Finding Intersection between 2 Trend Lines

    Either kaper's or my solution should work for this. Did you have a chance to try either or both of them? Do you have specific questions about implementing one of them?

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Finding Intersection between 2 Trend Lines

    Assuming your data is always monotone non-increasing as in your example,

    A
    B
    C
    2
    X
    Y
    3
    4.00
    211
    4
    4.67
    211
    5
    10.66
    199
    6
    12.87
    187
    7
    69.64
    112
    8
    70.11
    112
    9
    72.32
    100
    10
    72.32
    0
    11
    75.00
    0
    12
    13
    X
    Y
    14
    49
    139.27
    B14: =PERCENTILE(B3:B11, 1 - PERCENTRANK(A3:A11, A14, 8))


    Your two different Y values for X = 72.32 are a little sketchy.
    Last edited by shg; 09-10-2018 at 01:24 PM.
    Entia non sunt multiplicanda sine necessitate

  8. #8
    Registered User
    Join Date
    12-26-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    23

    Re: Finding Intersection between 2 Trend Lines

    Thanks everyone, in the end i used Kaper's solution as I could follow it through nice and easily, works a charm!

    Thanks again

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Getting point of intersection for two lines
    By adelkam in forum Excel General
    Replies: 1
    Last Post: 07-02-2016, 05:04 PM
  2. Calculating the intersection of 2 lines 2
    By MattRNR in forum Excel General
    Replies: 3
    Last Post: 03-14-2014, 09:34 PM
  3. Calculating the Intersection of 2 lines
    By MattRNR in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-24-2013, 09:03 AM
  4. Finding the intersection of two trend lines.
    By kafansler in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 01-02-2013, 03:09 PM
  5. [SOLVED] How to find intersection points between lines using Excel?
    By Saurabh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-16-2006, 12:55 PM
  6. [SOLVED] Intersection of two lines
    By akr in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-26-2006, 08:20 AM
  7. display intersection value for 2 lines
    By gab2409 in forum Excel General
    Replies: 3
    Last Post: 02-28-2005, 12:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1