How to Do Linear Interpolation in Excel (7 Handy Methods)

Let’s say, you know the values of two known points A (x1,y1) and C (x2,y2) of a straight line and you want to determine the unknown value y from the point of B (x,y) when you also know the x. In that case, the mathematical equation is as follows:

y=y1+ (x-x1)*(y2-y1)/(x2-x1)


Linear Interpolation in Excel: 7 Methods

Let’s introduce the following dataset where the Number of Visits is given on the basis of the Day of a well-known Excel learning website. Now, you need to interpolate the Number of Visits for a specific Day.

Dataset


Method 1 – Using the Equation of the Linear Interpolation

Suppose you want to find the Number of Visits for Day number 55.

How to Do Linear Interpolation in Excel Using the Equation of the Linear Interpolation

  • Insert the following formula in the G5 cell:

=D9+(F5-C9)*(D10-D9)/(C10-C9)

Here, D9 and D10 are the Number of Visits for Day numbers 50 and 60 respectively whereas C9 and C10 are the cells having the values of the corresponding Day.

But why do you need cells C9 and C10? Because you want to interpolate for Day 50 and it lies between those cells.

How to Do Linear Interpolation in Excel Using the Equation of the Linear Interpolation

  • After pressing Enter, you’ll get the interpolated Number of Visits is 7383.

How to Do Linear Interpolation in Excel Using the Equation of the Linear Interpolation


Method 2 – Applying the FORECAST Function to Do Linear Interpolation

  • Here’s a function to determine the Number of Visits for Day 75:

=FORECAST.LINEAR(F5,D5:D14,C5:C14)

F5 represents the value for which you want to interpolate, D5:D14 is the known_y’s argument which is mainly the dependent range of data (Number of Visits) and the C5:C14 is the known_x’s argument representing the independent range of data (Day).

How to Do Linear Interpolation in Excel Applying the FORECAST Function

  • You’ll get the following output.

Applying the FORECAST Function


Method 3 – Using the TREND Function

Use the following formula:

=TREND(D5:D14,C5:C14,F5,1)

Here, 1 is for defining the value of const is 0.

Using the TREND Function

The output will look as follows.

Using the TREND Function


Method 4 – Utilizing the SLOPE and INTERCEPT Functions

You can also interpolate via the equation for the simple linear regression. That is Y = a + bX, where Y and X are the dependent and independent variables. Here, a is the intercept and b is the slope value.

  • Use the following formula:

=SLOPE(D5:D14,C5:C14)*F5+INTERCEPT(D5:D14,C5:C14)

While computing the linear interpolation, you need to multiply the slope (as illustrated in the equation) with the independent variable (value of Day 32).

Utilizing the SLOPE and INTERCEPT Functions

The output will be as follows.

Utilizing the SLOPE and INTERCEPT Functions


Method 5 – Combined Application of FORECAST, OFFSET, and MATCH Functions

  • Use the following formula for the result cell:

=FORECAST(F5,OFFSET(D5:D14,MATCH(F5,C5:C14,1)-1,0,2),OFFSET(C5:C14,MATCH(F5,C5:C14,1)-1,0,2))

In the above formula, OFFSET(D5:D14,MATCH(F5,C5:C14,1)-1,0,2) syntax specifies the reference for the dependent values (known_y’s). Here, the MATCH function finds the relative position of the lookup value (F5 cell) for which you want to interpolate. Besides, 0 is the Cols (column) argument of the OFFSET function. It is zero as you are going to interpolate in the same column. Besides, the value of the Height argument is 2 because you want to interpolate for the last 2 values.

The OFFSET(C5:C14,MATCH(F5,C5:C14,1)-1,0,2)) formula returns the reference for the independent variables (known_x’s).

The FORECAST function interpolates the Number of Visits for Day 45 (listed in cell F5).

How to Do Linear Interpolation in Excel Combined Application of FORECAST, OFFSET, and MATCH Functions

You’ll get the following output.

Combined Application of FORECAST, OFFSET, and MATCH Functions


Method 6 – Using INDEX and MATCH Functions to Do Linear Interpolation

  • Use the following formula for x1:

=INDEX(C5:C14,MATCH(G8,C5:C14,1))

Here, G8 is the value of Day 85 (x) for which you want to interpolate. The above formula finds the value of x1 where the MATCH function returns the relative position of the lookup value. 1 is used to find the lower value if the exact value is not found. Finally, the INDEX function returns the matched value from the known_y’s.

Using INDEX and MATCH Functions

  • Use the following formula for x2:

=INDEX(C5:C14,MATCH(G8,C5:C14,1)+1)

Here, 1 is added to find the higher value than the lookup value especially if exact matching is not found.

Using INDEX and MATCH Functions

  • Use the following formula for y1:

=INDEX(D5:D14,MATCH(G8,C5:C14,1))

The same thing happens here except for dealing with the independent range of data.

Using INDEX and MATCH Functions

  • Use the following formula for y2:

=INDEX(D5:D14,MATCH(G8,C5:C14,1)+1)

How to Do Linear Interpolation in Excel Using INDEX and MATCH Functions

  • Finally, copy the following function to interpolate based on the found values of  x1,x2, and y1,y2:

=FORECAST(G8,G11:G12,G9:G10)

Here, G11:G12 is the cell range of known_y’s and G9:G10 is for the known_x’s.

How to Do Linear Interpolation in Excel Using INDEX and MATCH Functions

You’ll get the following output.

How to Do Linear Interpolation in Excel Using INDEX and MATCH Functions


Method 7 – Using the XLOOKUP Function to Do Linear Interpolation in Excel

Available from Excel for Microsoft 365 and Excel 2021.

  • Use the following formula for x1:

=XLOOKUP($G8,$C$5:$C$14,C$5:C$14,,-1,1)

Here, -1 (the value of the match_mode argument) is for finding the next smaller item and 1 is for searching from the top of the array (search_mode argument)

Using the XLOOKUP Function

  • Use the following formula for x2:

=XLOOKUP($G8,$C$5:$C$14,C$5:C$14,,1,1)

Here, 1 (the value of the match_mode argument) is for finding the next largest value.

Using the XLOOKUP Function

  • Use the following formula for y1:

=XLOOKUP($G8,$C$5:$C$14,$D$5:$D$14,,-1,1)

This formula is the same as the earlier one. The only exception is here i.e. dealing with the dependent range of data.

Using the XLOOKUP Function

  • Use the following formula for y2:

=XLOOKUP($G8,$C$5:$C$14,$D$5:$D$14,,1,1)

How to Do Linear Interpolation in Excel Using the XLOOKUP Function

  • Use the FORECAST function to interpolate and you’ll get your desired output:

=FORECAST(G8,G11:G12,G9:G10)

How to Do Linear Interpolation in Excel Using the XLOOKUP Function

Read More: How to Do VLOOKUP and Interpolate in Excel


Things to Remember

  • If the value of the x is non-numeric, you’ll get #VALUE! Error in the case of using the FORECAST function.
  • If the cells of known_x’s and known_y’s are empty, you’ll get a  #N/A error.

Download Practice Workbook


Related Articles


<< Go Back to Excel Interpolation | Excel for Statistics | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Md. Abdul Kader
Md. Abdul Kader

MD. ABDUL KADER is an engineer with a talent for Excel and a passion for VBA programming. To him, programming is like a time-saving wizard, making data manipulation, file handling, and internet interactions a breeze. His skill set extends to SWM, GIS, RS, and SPSS. He holds a B.Sc in Urban & Regional Planning from Chittagong University of Engineering and Technology and has shifted to become a content developer. In this role, he crafts technical content centred around... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo