0% found this document useful (0 votes)
222 views

Interpolate Values Using The FORECAST Function - Excel Off The Grid

The document discusses three methods for interpolating values from a table of X and Y data points: 1. Using simple mathematics, which works well for linear data. 2. Using the FORECAST function, which estimates values based on all data points rather than just the endpoints. 3. For non-linear data, using INDEX, MATCH and FORECAST functions to interpolate between the values above and below the target value.

Uploaded by

toanvmpetrologx
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
222 views

Interpolate Values Using The FORECAST Function - Excel Off The Grid

The document discusses three methods for interpolating values from a table of X and Y data points: 1. Using simple mathematics, which works well for linear data. 2. Using the FORECAST function, which estimates values based on all data points rather than just the endpoints. 3. For non-linear data, using INDEX, MATCH and FORECAST functions to interpolate between the values above and below the target value.

Uploaded by

toanvmpetrologx
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

HOME BLOG ADD-INS DOWNLOADS VBA RESOURCES CONTACT

Interpolate values using the FORECAST function FOLLOW ME ON SOCIAL MEDIA

Posted on May 11, 2017 by Excel Off The Grid Follow @exceloffthegrid

NEWSLETTER

Subscribe to receive exclusive content,


tips and tricks, tools and downloads.

You will also receive the Tab Hopper


Add-in for FREE.

First Name:
Your Name

Email address:
Your email address
Recently, I received the following question from a reader:

Join
I have an Excel question Is there a way to interpolate a value from a table? I have an X and Y that are not on the table, but have
correlated data so want to calculate the interpolated value.
SAVE TIME WITH THE FLIP ADD-IN
At rst, I thought I could just use simple mathematics, which would de nitely work if the results were perfectly linear. But what
if they are not? What if they are not perfectly not perfectly correlated? I then thought about Excels FORECAST function.
Based on its name, the FORECAST function seems like an odd choice, but its actually one of the best options for linear
interpolation. However, what if the X and Y relationship is not linear at all? Then there would need to be a different approach.

In this post well look at these three options:

Interpolation using simple mathematics


Interpolation using the FORECAST function
Interpolation when the data is not linear.
RESOURCES

Interpolation using simple mathematics


Using simple mathematics works well when there are just 2 pairs of numbers or where the relationship between X & Y is
perfectly linear. Here is a basic example:

The formula in Cell E3 is:

=B2+(E2-A2)*(B3-B2)/(A3-A2)

RECENT BLOG POSTS

That might look a bit complicated to some, so Ill just give a quick overview of this formula. Build your own Add-in: Calculation
Timer

Push Add-in launched


=B2+(E2-A2)*(B3-B2)/(A3-A2)
Excel charting tips for when youre in a
rush

The last section (highlighted in red above) calculates how much the Y value moves whenever the X value moves by 1. In our The 7 most dangerous Excel features
example, Y moves by 1.67 for every 1 of X.
Advanced Excel Essentials in the real
world
=B2+(E2-A2)*(B3-B2)/(A3-A2)

The second section (in red above) calculates how far our interpolated X is away from the rst X, then multiplies it by the value
calculated above. Based on our example, it is 17.5 (Cell E2) minus 10 (Cell A2), the result of which is then multiplied by 1.67
(which is 12.5).

=B2+(E2-A2)*(B3-B2)/(A3-A2)

Finally, in the rst section of the formula (in red above), we add the rst Y value. In our example, this this provides a nal result
of 77.5 (65 + 12.5). For anybody who remembers high school mathematics the formula is as follows:

Even if you dont remember that from school, the good news is that Excel has given us a much simpler option, the FORECAST
function.

Interpolation using the FORECAST function


The FORECAST function is great when we want to extrapolate values, for example when trying to forecast the value of a future
point. But, FORECAST can also be used to estimate an interpolated value.

Using the same numbers as above, the function in Cell E3 could have been:

=FORECAST(E2,B2:B3,A2:A3)

The FORECAST function has the following Syntax:


=FORECAST(x,known_y's,known_x's)

The 3 arguments in the function are

x the data point for which we want to predict a value


known_ys the range of cells or array of values containing the known Y values
known_xs the range of cells or array of values containing the known X values

When using the FORECAST function the result of Cell E3 is also 77.5 (just as in the rst example above).

But . . . what if our data isnt perfectly linear? Look at the chart below, the data has a linear relationship, but its not perfect.

In these circumstances the FORECAST function is even more useful, as it does not just interpolate between the rst and last
values.

The function in Cell E3 is:


=FORECAST(E2,B2:B11,A2:A11)

In these circumstances, the FORECAST estimates a value based on all the available data, rather than just the start and end
points. The result of the FORECAST function in cell E3 is an estimated a value of 77.3 (rounded to 1 decimal place), which is
more accurate than if we had applied simple linear interpolation.

Interpolation when the data is not linear


But, what if the data is not linear at all? Then what? Here is our new data:

Look at the chart below. If we took a simple linear approach, that will give us a value of 77.5, quite a long way from the curve.
Using the FORECAST function as above would provide a result of 70.8, also a long way from the curve.
In this circumstance, our approach will need to change. We need to nd a way of obtaining the result above and the result
below the value we wish to interpolate, then using linear interpolation between those two points. Using our example of 17.5,
we would need to retrieve the results of 16 and 18, then calculate the linear interpolation. To do this we will use the INDEX,
MATCH and FORECAST functions combined.

Firstly, we need to use the MATCH function to retrieve the position of the value lower than 17.5.

=MATCH(E2,A2:A11,1)

The last argument of the MATCH function indicates that we wish to use an approximate match (i.e. the closest value below the
lookup value). 16 is the closest value below 17.5. 16 is the 5th item in the list of X values, so it will return the value of 5.

This is where it starts to get a bit tricky. We can combine the INDEX function with the MATCH function to create a range for
the two Y values (note this method does require the data to be sorted in ascending order).

INDEX(B2:B11,MATCH(E2,A2:A11,1)):INDEX(B2:B11,MATCH(E2,A2:A11,1)+1)

The rst INDEX function will return the cell reference of B6 (the result of the red highlighted section). The second INDEX
function will return the cell reference of B7 (the result of the blue highlighted section). These are separated by a colon ( : ), to
create a range B6:B7

We can do the same to create a range for the two X values.


INDEX(A2:A11,MATCH(E2,A2:A11,1)):INDEX(A2:A11,MATCH(E2,A2:A11,1)+1)

Note: It is also possible to use the OFFSET function if you prefer (but it is a volatile function, so may cause slower calculations).

Now, lets combine the range we created for the Y values and the range we created for the X values within the FORECAST
function.

=FORECAST(E2,
INDEX(B2:B11,MATCH(E2,A2:A11,1)):INDEX(B2:B11,MATCH(E2,A2:A11,1)+1),
INDEX(A2:A11,MATCH(E2,A2:A11,1)):INDEX(A2:A11,MATCH(E2,A2:A11,1)+1))

Thats a pretty big formula, right. Hopefully Ive managed to explain it, so that its not too scary.

The result of the Non-Linear FORECAST function is 67.6 (to 1 decimal place, shown in Cell F5 below). Have a look at the chart
again you will see it is much more accurate estimation based on the data we have.

One word of warning ultimately this is still a linear Interpolation, but based on the two values either side. Therefore, the
distance between the values above and below will have a direct impact on how accurate the interpolation is.

What next?
Get Excel news, tips & tricks straight to you inbox. Helping you to save time and achieve more with Excel.

You will also receive the Tab Hopper Add-in for FREE.

First Name:
Your Name

Email address:
Your email address

Join

Posted in Blog, Formulas

The Ultimate Guide to Slopegraphs in Excel Using hidden cells in a chart

Leave a Reply
Your email address will not be published. Required elds are marked *

Comment
Name *

Email *

Website

Post Comment

Theme by Out the Box Home Terms and conditions Privacy policy Contact

You might also like