Even though this is an Excel forum, this might be easiest in QuattroPro if you have it, because QuattroPro had a nice built in linear interpolation function (@LINTERP). I don't know about other spreadsheets, but Microsoft just doesn't seem to want to put a linear interpolation function into Excel.
If you are stuck with Excel, here's how you do it. As you've observed, the formula for linear interpolation is easy once you've isolated the interval that contains your desired x value. So the hard part of linear interpolation is locating the interval containing x.
1) Use the MATCH() function to locate the interval containing x
2) Use the INDEX() function (4 instances) to extract the x and y values at the endpoints of that interval
3) Use your formula (or the TREND() function can also work) to determine y at you given x
I'm not real good at nor fond of trying to build this kind of thing into a single cell. I prefer to spread this out over several cells. I expect someone here is good at nesting these functions in a way that will yield a single cell, if you really need it condensed to one cell.
Bookmarks