+ Reply to Thread
Results 1 to 4 of 4

Find next xy value greater than linear equation

  1. #1
    Forum Contributor
    Join Date
    04-26-2017
    Location
    Brussels, Belgium
    MS-Off Ver
    2010
    Posts
    133

    Smile Find next xy value greater than linear equation

    I have a sheet with xy datapoints from which linear equations are calculated (y= mx+b).
    I have one row with the slope (m) and one row with the b-value.

    For every datapoint, I want to find the next higher point that is higher than the linear function by filling in the equation with corresponding x point in the equation and comparing the expected y value with the actual y value.
    Can anyone help me with this?

    I added a samplefile.

    Thanks so much for your time!
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    04-26-2017
    Location
    Brussels, Belgium
    MS-Off Ver
    2010
    Posts
    133

    Re: Find next xy value greater than linear equation

    To show what I want to achieve:
    screen.png

    I create an equation autof point 1 and 2 and then I need to find the first point that is located higher than the equation.
    This needs to happen for every datapoint.

    For datapoint 2 it means we have another equation (connection 2 & 3) where datapoint 4 will be the result.
    See my excel in the first post for details about the linear equation.

    Thanks for looking into it with me.

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

    Re: Find next xy value greater than linear equation

    Do you have expected results for your sample file? My procedure finds only one case where subsequent y values are larger than the linear extrapolation of a given pair of points -- the equation between points 3 and 4 is y=-11, and y(5) is -10 which is larger than -11.

    Is there a specific part of this analysis that you are having trouble with? It seems simple enough, the only real difficulty I had (other than there seemed to be a lot of no solution answers) is arranging the calculation in the spreadsheet. Here's what I did:

    1) Make a transposed copy of the X and Y values down below and to the left of the table. I selected A22:B28 and entered =TRANSPOSE(C8:I9).
    2) Compute the values along each line using the transposed X values and the slope and intercept in rows 13 and 14. =$A22*C$13+C$14 entered into C22, then copy down and across into C22:I28
    2a) Of course, the "horizontal" and "vertical" lines generate errors. There will never be a solution (assuming I understand) for the vertical lines, so I ignored those errors. For the "horizontal" lines, I changed the slope formula in row 13 to output 0 instead of "horizontal", which allowed those lines to calculate.
    3) Scan down each column and find the first point (below the point #) where the value in column B is larger than the value in the column you are looking at. So, in column C, I see that there are no values in C24:C28 that are smaller than B24:B28. In column E, I scan E26:E28 and I see that B26 is greater than E26. I did not formalize a function for this step, because, as I indicated, I am not sure I am understanding the problem correctly.
    4) Not essential to the analysis, but, in order to visualize the process, I selected C8:I9 and inserted a scatter chart (with row 8 as the x values and row 9 as the y values, if Excel messes that part up). The chart suggested the same result that the analysis gave -- Y(5) is the only Y value that is larger than the linear interpolation/extrapolation of the previous points.

    Even if I have misunderstood something, that is how I envision solving this problem. Make a transposed copy of your X,Y values, then devise a formula for that 2D grid that will compute the values along the line and make the needed comparisons.
    Last edited by MrShorty; 07-10-2018 at 08:20 PM.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Forum Contributor
    Join Date
    04-26-2017
    Location
    Brussels, Belgium
    MS-Off Ver
    2010
    Posts
    133

    Re: Find next xy value greater than linear equation

    Hello MrShorty,

    I did it the way you suggested.
    I just thought that there would be a less complex way of doing this since I have way more datapoints than I showed in the simplified sample file.
    Now I have 3600 points that are calculated in separate sheets, I somehow wanted to avoid this since I think this is kindof heavy for something that seems simple to do with some kind of function (that apparently doesn't exist.. I was too optimistic .. )
    Anyways, it's solved! I thank you sir!

+ 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. Bisection - non-linear equation
    By itam1995 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-19-2015, 12:02 AM
  2. Scatter graph linear trendline and equation to find unknown
    By S_9 in forum Excel Charting & Pivots
    Replies: 9
    Last Post: 05-09-2013, 08:26 PM
  3. Replies: 1
    Last Post: 04-21-2012, 07:18 PM
  4. Solving non-linear equation
    By Lagrene in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-16-2011, 06:56 PM
  5. how do I graph a linear equation?
    By Throstle in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 06-16-2011, 05:04 AM
  6. Replies: 3
    Last Post: 03-06-2011, 01:38 PM
  7. Linear equation
    By tah2n in forum Excel General
    Replies: 0
    Last Post: 04-29-2009, 11:43 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