+ Reply to Thread
Results 1 to 13 of 13

interpolation

  1. #1
    Registered User
    Join Date
    10-26-2009
    Location
    Hailsham, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    interpolation

    i have a spreadsheet with a column of numbers in increments of 5 ie 25, 30, 35, 40, 45, 50, etc. and an adjacent column of decending numbers ie 275,273,262,250,238 where the numbers in column b decrease by varying amounts each time. for a given value say 37 i want to interpolate between the corisponding values of 35 and 40 to give an answer. does this make sense.


    billy

  2. #2
    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: interpolation

    Post an example that shows what you want.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    10-26-2009
    Location
    Hailsham, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: interpolation

    there you go as i discribed earlier
    Attached Files Attached Files

  4. #4
    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: interpolation

    Put this is a code module:
    Please Login or Register  to view this content.
    And this in E3: =LINTERP(D3,$A$3:$A$18,$B$3:$B$18) (returns 245.2)

  5. #5
    Registered User
    Join Date
    10-26-2009
    Location
    Hailsham, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: interpolation

    sorry what do i do with that code i was after a function which i could use in a cell or do i use "=LINTERP(D3,$A$3:$A$18,$B$3:$B$18)[/COLOR]" however i tried to use the LINTERP function and received a #name error

  6. #6
    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: interpolation

    Adding a Macro to a Code Module
    1. Copy the code from the post
    2. Press Alt+F11 to open the Visual Basic Editor (VBE)
    3. From the menu bar in the VBE window, do Insert > Module
    4. Paste the code in the window that opens
    5. Close the VBE to return to Excel

  7. #7
    Registered User
    Join Date
    10-26-2009
    Location
    Hailsham, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: interpolation

    thanks for your help that worked a treat.

    is there a way to do it without using visual basic for future refference

    billy

  8. #8
    Registered User
    Join Date
    10-26-2009
    Location
    Hailsham, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: interpolation

    If i was to alter the table as shown in the new book 1 i have uploaded and add a second pb column so depending on which column i select it will interpolate relative to that column.

    bear in mind that i may want to add further pb columns at a later date how do i add a match or hlookup to your original code and how do i ammend to suit any given number of columns

    thanks

    billy
    Attached Files Attached Files

  9. #9
    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: interpolation

    See attached.
    Attached Files Attached Files

  10. #10
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: interpolation

    Quote Originally Posted by festering View Post
    is there a way to do it without using visual basic for future refference
    Hello billy,

    using shg's setup you could use this formula in H3

    =MATCH(G2,B2:E2,0)

    then in I3 for the result

    =LOOKUP(F3,A3:A17,INDEX(B3:E17,0,H3)+(INDEX(B4:E18,0,H3)-INDEX(B3:E17,0,H3))*(F3-A3:A17)/(A4:A18-A3:A17))

    assumes that A3:A18 will be sorted ascending

  11. #11
    Registered User
    Join Date
    04-30-2014
    Location
    5
    MS-Off Ver
    1
    Posts
    6

    Re: interpolation

    Quote Originally Posted by daddylonglegs View Post
    ,

    =LOOKUP(F3,A3:A17,INDEX(B3:E17,0,H3)+(INDEX(B4:E18,0,H3)-INDEX(B3:E17,0,H3))*(F3-A3:A17)/(A4:A18-A3:A17))

    assumes that A3:A18 will be sorted ascending
    Hi,

    I am trying to interpolate y value for a fixed x value using the above formula. My x by y data has a quadratic function so x is not sorted ascending (while the formula demand that order), but y is in an ascending order. I many of my spreadsheets, the result returned valid, but not always. I have uploaded a sample spreadsheet with this post. I will use this formula across sheets (I can do that), but need to return the results across sheets in to a new sheet by sheet number. Sorry I don't have knowledge of programing.

    Thanks,
    Abys
    Attached Files Attached Files

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

    Re: interpolation

    Abys: We will be happy to help you, but this forum is pretty strict about not posting questions in someone else's thread. Post your question in a new thread. If you feel that this thread would be helpful for those helping you, you can include a link to this thread.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  13. #13
    Registered User
    Join Date
    04-30-2014
    Location
    5
    MS-Off Ver
    1
    Posts
    6

    Re: interpolation

    Thanks.
    I will do that.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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