+ Reply to Thread
Results 1 to 6 of 6

Interpolate missing data

  1. #1
    Registered User
    Join Date
    03-09-2015
    Location
    China
    MS-Off Ver
    2013
    Posts
    14

    Post Interpolate missing data

    Hi guys,
    i have a data on stock prices for about 25 years. Apart from weekends, some weekdays are missing and i would like to fill them up with data through interpolation. I am however not sure how to do it in Excel. Could someone help using with this sample date below:

    Date stock price
    04/01/1999 943.969971
    05/01/1999 926.25
    06/01/1999 911.929993
    07/01/1999 900.48999
    11/01/1999 933.830017
    12/01/1999 923.219971
    13/01/1999 920.559998
    14/01/1999 924.190002
    18/01/1999 932.840027
    22/01/1999 930.710022
    25/01/1999 931.76001
    26/01/1999 923.590027
    27/01/1999 922.469971
    28/01/1999 917.210022
    29/01/1999 900.580017
    01/02/1999 907.599976
    02/02/1999 882.349976
    03/02/1999 891.950012
    04/02/1999 867.72998
    05/02/1999 867.72998
    08/02/1999 852.440002
    09/02/1999 874.609985
    10/02/1999 874.359985
    11/02/1999 861.789978
    12/02/1999 874.900024
    15/02/1999 910.719971
    16/02/1999 915.48999
    17/02/1999 915.719971
    18/02/1999 911.25

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

    Re: Interpolate missing data

    Your question sounds very similar to this discussion I participated in: http://www.excelforum.com/showthread.php?t=1145387 Note that the strategy I used was to remove the blanks from the source table to create a separate lookup table. Then perform the interpolation using the lookup table. Review the discussion and examples, and let us know what part you don't understand or get stuck on.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    03-09-2015
    Location
    China
    MS-Off Ver
    2013
    Posts
    14

    Re: Interpolate missing data

    Thanks @MrShorty, let me go check it out

  4. #4
    Registered User
    Join Date
    03-09-2015
    Location
    China
    MS-Off Ver
    2013
    Posts
    14

    Re: Interpolate missing data

    Hey @MrShorty, i got quite confused with the link especially step 2. I have however attached my file so we can demonstrate for it. What i
    need is to add new dates in column A (for missing dates) and then later interpolate missing values in column B [CLOSE].Please check an example where
    i have highlighted in yellow.
    Attached Files Attached Files

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

    Re: Interpolate missing data

    What about step 2 was confusing? Did you follow the link to the help files for the functions so you would know how to use them? Or was there something else about using those functions that you found confusing.

    As an example of how I would use these functions for this:
    1) I might enter =SLOPE(B2:B3,A2:A3) in E2 and INTERCEPT(B2:B3,A2:A3) in F2 to get slope and intercept for the first entry. Note the relative referencing. Copy those formulas down to get slope and intercept for each entry. You might need to adjust the references for the very last entry, if you need to extrapolate beyond the last date. This table will be used as the lookup table to perform the interpolations.
    2) Create a second table where I perform the interpolation. Perhaps in I2, enter 1/4/1999, in I3, enter I2+1 (again, note relative references) and copy I3 down as far as needed.
    3) Slope for each day is a simple lookup function =VLOOKUP(I2,$A$2:$F$4000,5,TRUE). A similar function returns the INTERCEPT(). Note the mix of relative and absolute references, and that I used TRUE for the 4th argument of the VLOOKUP() function. https://support.office.com/en-us/art...8-93a18ad188a1
    4) From the slope and intercept, the linear interpolation is a simple y=mx+b function.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,531

    Re: Interpolate missing data

    This proposed solution uses more than a few helper columns. I know that it is policy to show the formulas used however since there were so many I am going to generally explain the way I came up with the Column of Interpolated Values. First I made a column of all dates between 1/4/1999 and 1/1/2014. I did this by putting 1/4/1999 in F2. I then held the right mouse button while pulling the fill handle of F2 down and then up, chose series from the pop up box, chose columns, and put 1/1/2014 in the stop value box. I then reduced that list, in the next column, to only weekdays as per post #1. The next column uses the INDEX function to match the closing price to the date. The next column gives the average for closings that could go in the places where only one cell is left blank between closings. The next column gives a list of closings, the originals as well as the averages placed in cells that were a single date's closing was skipped (I hope that makes sense). The next three columns are used to identify the number of rows that left blank so that the formula 'Average per blank' column will have that information. The 'average per blank' column will take the difference in the closing on the dates before and after the skip and divide by the number of rows skipped plus one. The 'Interpolated Column' then displays all of the values for all weekdays between 1/4/199 and 1/1/2014.
    If you decide to use this solution you may want to hide all of the helpers, basically all of the columns except G and O.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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. Interpolate between data
    By abduljaleel.mca in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-08-2013, 10:41 AM
  2. Interpolate between data - NOT WORKING?
    By Conrad1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-18-2013, 12:05 PM
  3. Interpolate data
    By wenners68 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-14-2012, 05:22 AM
  4. How to interpolate chart data from three parameters.
    By cslaton in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-16-2012, 08:26 AM
  5. VBA to interpolate missing values in table
    By adfo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-25-2009, 12:08 PM
  6. Interpolate missing values
    By pilch in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-13-2009, 06:59 AM
  7. [SOLVED] interpolate missing data between points
    By Rocket Rod in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-27-2005, 04:06 PM
  8. how do i interpolate data
    By mp in forum Excel General
    Replies: 1
    Last Post: 02-08-2005, 02:06 PM

Tags for this Thread

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