+ Reply to Thread
Results 1 to 5 of 5

Interpolation in excel with VBA

  1. #1
    Registered User
    Join Date
    07-28-2010
    Location
    Europe
    MS-Off Ver
    Excel 2003
    Posts
    6

    Interpolation in excel with VBA

    Hi

    I have just started to work on a routine for excel developed with VBA.

    One of the sub tasks within the routine is to interpolate between different sets of datapoints. For this task I am using the following calculations:

    =FORECAST(NewX,OFFSET(KnownY,MATCH(NewX,KnownX,1)-1,0,2),OFFSET(KnownX,MATCH(NewX,KnownX,1)-1,0,2))

    Somehow I have allot of difficulty to implement this into my routine and I hope therefore someone could help me to solve this problem. See the attached file which included the specific part of the routine.

    Best regards
    John
    Attached Files Attached Files

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Interpolation in excel with VBA

    The offset function is not available via the object model.

    Instead use the OFFSET object of the range reference.

    Please Login or Register  to view this content.
    This will get you to the next line in your routine, which fails due to x_val being -10, which is an invalid value for the Cells objects.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    07-28-2010
    Location
    Europe
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Interpolation in excel with VBA

    Thanks for your input and help
    Yes I also discovered a couple of minor errors in the code beside the interpolation function.

    Quote Originally Posted by Andy Pope View Post
    The offset function is not available via the object model.

    Instead use the OFFSET object of the range reference.

    Please Login or Register  to view this content.
    This will get you to the next line in your routine, which fails due to x_val being -10, which is an invalid value for the Cells objects.

  4. #4
    Registered User
    Join Date
    02-27-2011
    Location
    Massachusetts, USA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Interpolation in excel with VBA

    EZplot for Excel has an interpolate function. There is a trial version at www.OfficeExpander.com
    Regards

  5. #5
    Registered User
    Join Date
    12-26-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Interpolation in excel with VBA

    Hi,

    Is there any way to find the opposite, i.e. finding the x-value given the y-value? I tried reversing the axis in the formula but somehow it did not work. I believe it appears to be more than just reversing the axis. Thanks for helping~

    PT

+ 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