# How to perform a linear interpolation in Excel

1. ## How to perform a linear interpolation in Excel

Hi,
I'm trying to do a very simple thing - but I fail...
I have an array of data (x and y).
I have a x value that does not match exact to my data point, so I would like to do a linear interpolation between the two points closest to my value (i.e. upper and lower) and return the interpolated y value.
It sounds simple to my ear - but i cannot make it work. My data are in ascending order. I have tried VLOOKUP and INDEX/MATCH just to find the relevant two y-values but are having problems to find both the lower value and the upper value (as MATCH wants the data to be en ascending order to find lower value and desending to find upper - I think).

So in short - how do I perform a simple linear interpolation in excel ?

Value 2,3

X Y
1 10
2 20
3 30
4 40
5 50

Find y corresponding to x = 2,3

Kind Regards Torben  Register To Reply

2. ## Re: Interploate...

We would very much like to help you with your query, however the thread title does not really convey what your request is about.
Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

(Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)  Register To Reply

3. ## Re: Interploate...

Sorry about that - tried to adjust it. Hope it's more accurate now :-)  Register To Reply

4. ## Re: How to perform a linear interpolation in Excel

That's better.   Register To Reply

5. ## Re: How to perform a linear interpolation in Excel

I always find "manual interpolation" much easier than putting it in an excel formula. but it is doable. vlookup gets me stuck to easy, using index and match helps me to solve.

just to help understand the values a bit better I have put X and Y values in col x and y cols so you can read in the formula if x or y value is used in which part

so that resulted in

Formula:  `Please Login or Register  to view this content.`

MATCH(AA3;\$X\$2:\$X\$6;1) finds the values closest but always less then the desired value.
MATCH(AA3;\$X\$2:\$X\$6;1)+1 simply finds the next row in the value that will be over the wanted x

the index parts in the formula helps to eighter use the X value or the Y value in the formula

if you translate each index to its value it will show..

X to find Y value for in my example is 2,25 (in cell AA3 for this example) this will result in the following outcome for each index formual above

y= 20 + ((2,25-2)*(30-20)/(3-2))

y = 20 + 0,25*10

y = 22,5

The formula could be simplified somewhat if the interval of x values is always 1 but because changes are this is not always the case this formula will work on any interval. To help understand the formula you can also use the evaluate formula option under formulas menu in the Formula Auditing section (3rd or 4th section on the ribbon)  Register To Reply

6. ## Re: How to perform a linear interpolation in Excel

Or try this formula

Formula:  `Please Login or Register  to view this content.`

where A1, B1 are labels, A2:A6 are the x_values, B2:B6 the y_values and D2 the x you want to get.

Note: Formula is valid to x in [A2, A6[
You must indicate the office version not the operating system.  Register To Reply

7. ## Re: How to perform a linear interpolation in Excel

@Roel
Thanks a lot. I would never have solved this :-)  Register To Reply

8. ## Re: How to perform a linear interpolation in Excel

@José
I can not make your suggestion work. I can't see B2:B6 in your formula, instead you have twice A1:A6. Is that correct ??  Register To Reply

9. ## Re: How to perform a linear interpolation in Excel

@Jose
Sorry, it works. Just still can't see the ref. to B2:B6? (but it's working nicely). Is it a truly linear fit ?  Register To Reply

10. ## Re: How to perform a linear interpolation in Excel

When these questions come up, I sometimes wish that QuattroPro was still around. QuattroPro had a nice, built in @LINTERP() function that made short, easy work of linear interpolation problems.

As a different alternative, I find that I prefer to not try to do linear interpolation in a single cell formula. I prefer to spread it out. Compute slope and intercept for each segment in helper columns adjacent to the original data "lookup table". Then the linear interpolation becomes something simpler =VLOOKUP(known_x,lookup_table,intercept_column,TRUE)+x*VLOOKUP(known_x,lookup_table,slope_column,TRUE). I've illustrated this in this old thread: https://www.excelforum.com/excel-cha...e-a-curve.html  Register To Reply

11. ## Re: How to perform a linear interpolation in Excel

Yes, is a true linear fit because it's use only two values for x and two for y.

B2:B6 can be referred by OFFSET(B1,1,0,5,1).  Register To Reply

##### Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### 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