Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Interpolation

0 views
Skip to first unread message

Enrique BLANCO

unread,
Aug 1, 2000, 3:00:00 AM8/1/00
to
What about interpolating between values, this is something I can not
find on the EXCEL functions, there is VSLOOKUP,... but not the same
since the value used to search should be there, any help ?

Input Output
1 10
2 20
3 30

If the user introduces 1.2, the result should be 12 (interpolation)

Thanks in advance,
E. Blanco

Rata

unread,
Aug 2, 2000, 3:00:00 AM8/2/00
to

I don't understand why Excel doesn't have an interpolation function.
(LINEST is not a substitute.)

I use a simple macro function (that I wrote a while ago), and put it in
personal.xls as I use it fairly often.

HTH

Peter Hewett
------------------------------------------------
'
' Interpolation Function
' Author: P W Hewett
' Date: 1 July 1995
' Uses linear extrapolation if X is out of range!
'
Function Interp(X, XRange, YRange)
XP1 = 0
For Each c In XRange
If c > X Then Exit For
XP1 = XP1 + 1
Next c
Leng = XRange.Rows.Count - 1
If XP1 > Leng Then XP1 = Leng
If XP1 < 1 Then XP1 = 1
X0 = XRange.Cells(XP1).Value
X1 = XRange.Cells(XP1 + 1).Value
Y0 = YRange.Cells(XP1).Value
Y1 = YRange.Cells(XP1 + 1).Value
Interp = Y0 + (X - X0) * (Y1 - Y0) / (X1 - X0)
End Function
------------------------------------------------

"Enrique BLANCO" <Enrique...@cern.ch> wrote in message
news:398706AC...@cern.ch...

Harlan Grove

unread,
Aug 2, 2000, 3:00:00 AM8/2/00
to
In article <398706AC...@cern.ch>,

Enrique BLANCO <Enrique...@cern.ch> wrote:
>What about interpolating between values, this is something I can not
>find on the EXCEL functions, there is VSLOOKUP,... but not the same
>since the value used to search should be there, any help ?
>
>Input Output
>1 10
>2 20
>3 30
>
>If the user introduces 1.2, the result should be 12 (interpolation)

TREND() works for linear interpolation between two points. If your
sample table above were entered in A1:B4 (column headings in row 1),
then =TREND(B2:B3,A2:A3,1.2) will give 12.


Sent via Deja.com http://www.deja.com/
Before you buy.

0 new messages