ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Linear Interpolation UDF (https://www.excelbanter.com/excel-discussion-misc-queries/150514-linear-interpolation-udf.html)

Sloth

Linear Interpolation UDF
 
Does anyone have a good UDF for linear interpolation?

I want something like

Linterp(KnownXs, KnownYs, NewX)

It will find and use the two points surrounding NewX and linearly
interpolate the Y-value. If NewX is beyond the range of KnownXs, then it
will use either the first or last two to extrapolate an answer.

Please note, I am not asking you to make one for me, I would assume that
many people have already made one for themselves. Also I am not interested
in the LINEST, FORECAST, or TREND functions. They are not the same as linear
interpolation. I know you can use FORECAST if you have the two points you
want to use, but I would like to be able to pick the entire list of X's and
Y's.

MartinW

Linear Interpolation UDF
 
The following links have what you ask.

http://www.sulprobil.com/html/interpolate.html
http://www.tushar-mehta.com/excel/ne...ion/index.html

Despite what you say LINEST, FORECAST and TREND are the same as
linear interpolation and IMHO are, when used correctly, better than UDF
and VBA solutions.

HTH
Martin


"Sloth" wrote in message
...
Does anyone have a good UDF for linear interpolation?

I want something like

Linterp(KnownXs, KnownYs, NewX)

It will find and use the two points surrounding NewX and linearly
interpolate the Y-value. If NewX is beyond the range of KnownXs, then it
will use either the first or last two to extrapolate an answer.

Please note, I am not asking you to make one for me, I would assume that
many people have already made one for themselves. Also I am not
interested
in the LINEST, FORECAST, or TREND functions. They are not the same as
linear
interpolation. I know you can use FORECAST if you have the two points you
want to use, but I would like to be able to pick the entire list of X's
and
Y's.




Sloth

Linear Interpolation UDF
 
Thank you for the quick response.

"MartinW" wrote:

The following links have what you ask.

http://www.sulprobil.com/html/interpolate.html
http://www.tushar-mehta.com/excel/ne...ion/index.html

Despite what you say LINEST, FORECAST and TREND are the same as
linear interpolation and IMHO are, when used correctly, better than UDF
and VBA solutions.

HTH
Martin


"Sloth" wrote in message
...
Does anyone have a good UDF for linear interpolation?

I want something like

Linterp(KnownXs, KnownYs, NewX)

It will find and use the two points surrounding NewX and linearly
interpolate the Y-value. If NewX is beyond the range of KnownXs, then it
will use either the first or last two to extrapolate an answer.

Please note, I am not asking you to make one for me, I would assume that
many people have already made one for themselves. Also I am not
interested
in the LINEST, FORECAST, or TREND functions. They are not the same as
linear
interpolation. I know you can use FORECAST if you have the two points you
want to use, but I would like to be able to pick the entire list of X's
and
Y's.






All times are GMT +1. The time now is 10:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com