+ Reply to Thread
Results 1 to 7 of 7

Linear interpolation within a range of values

  1. #1
    Registered User
    Join Date
    03-13-2012
    Location
    Deventer, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    64

    Linear interpolation within a range of values

    Hi there,
    I'm in search for a formula that can perform linear interpolation between within arange of values.

    The case is best illustrated in the attached sheet. The formula need to be entered in the yellow cells (row 7), and should return the interpolated sieve diameter value for the percentages stipulated in row 6
    For example; the value in cell D7; should return a value which lies in between J2 and K2 (closer to the J2 value).

    Hope anybody knows how to work this.

    Kind regards,
    Niels
    Attached Files Attached Files

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

    Re: Linear interpolation within a range of values

    If you are not limited to Excel, Gnumeric has a built in INTERPOLATION() function that will make short work of this. =INTERPOLATION($B$3:$N$3,$B$2:$N$2,B6) copied across.

    If you are limited to Excel, I usually recommend something like these for linear interpolation:
    https://www.excelforum.com/excel-for...ml#post5262186
    https://www.excelforum.com/excel-for...ml#post4873049

    If you do this often enough, you might be interested in a VBA UDF. This thread has the beginnings of a linear interpolation UDF that could be used as a starting point: https://www.excelforum.com/excel-pro...-computer.html
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Banned User!
    Join Date
    02-26-2020
    Location
    US
    MS-Off Ver
    2010
    Posts
    157

    Re: Linear interpolation within a range of values

    Hi,

    I restructured your setup see Sheet 2 and try this formula:

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


    Press CTRL+SHIFT+ENTER to make it an array

  4. #4
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Linear interpolation within a range of values

    Ostensibly, you might enter =FORECAST(B6,$B$2:$N$2,$B$3:$N$3) into B7 and copy across into C7:J7.

    But that gives a very poor interpolation because the linear regression is a poor fit to the data in B2:N3. That is demonstrated by the fact that =RSQ(B3:N3,B2:N2) returns about 0.4064. A "good" fit would be closer to 0.9000 or above.

    This would be true for all other dependencies on the linear regression, e.g. it INTERCERPT and SLOPE.

    I think a pairwise interpolation would give you better results. One way to calculate that is to enter the following formula into B7 and copy across:

    =FORECAST(B6, OFFSET($B$2,0,MATCH(B6,$B$3:$N$3)-1,1,2), OFFSET($B$3,0,MATCH(B6,$B$3:$N$3)-1,1,2))

    You can confirm the correctness of the formula by entering formulas of the form =FORECAST(J6,M2:N2,M3:N3) in J8, for example.

    I use OFFSET here for simplicity. But that is a "volatile" function. Consequently, that formula and any cells that depend on it directly or indirectly are recalculated whenever any cell in the workbook is edited or Excel otherwise chooses to recalculate. That can cause huge performance problems if you have many hundreds or thousands of such formulas.

    Alternatively, I would replace OFFSET with references of the form INDEX(...):INDEX(...). But that can be messy and inefficient because of the multiple MATCH expressions. It would be better to put the MATCH formula into a "helper" cell, and reference it in the INDEX:INDEX expressions.
    Last edited by joeu2004; 03-27-2020 at 01:00 PM.

  5. #5
    Registered User
    Join Date
    03-13-2012
    Location
    Deventer, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: Linear interpolation within a range of values

    Joeu2004,
    many thanks! Your formula in red is exactly what I was looking for!

  6. #6
    Registered User
    Join Date
    03-13-2012
    Location
    Deventer, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: Linear interpolation within a range of values

    @RChad; your formula comes close, but it lacks interpolating in between the values given. The formula from the Joeu2004 does the trick anyhow thanks for your effort.

  7. #7
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Linear interpolation within a range of values

    Quote Originally Posted by joeu2004 View Post
    But that can be messy and inefficient because of the multiple MATCH expressions.
    its better then volatile
    Please Login or Register  to view this content.

+ 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. [SOLVED] Linear Interpolation of table values
    By tsmuts in forum Excel General
    Replies: 9
    Last Post: 12-27-2017, 03:57 PM
  2. Seeking tutoring HELP! with Linear Interpolation formula inputs
    By kashbay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-09-2017, 10:55 PM
  3. Replies: 1
    Last Post: 08-25-2017, 05:52 PM
  4. Type mismatch error when assigning values resulting from a linear interpolation
    By seigna in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2015, 09:01 PM
  5. Linear Interpolation help
    By jsuarez199 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 10-21-2013, 03:12 PM
  6. VBA Linear Interpolation
    By WAW in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-25-2010, 04:55 PM
  7. linear interpolation
    By Taha in forum Excel General
    Replies: 3
    Last Post: 01-31-2005, 11:06 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