Met verticaal zoeken leeftijd 45,5 moet als resultaat
geven ƒ 12,5.
Wie weet hoe dit moet of kan.
Alvast bedankt
René
"Rene" <re...@nieboer.net> schreef in bericht
news:070901c14509$aa76f730$b1e62ecf@tkmsftngxa04...
Maar als de lijst nu langer is. vb in A1 staat ook nog 44
en in B2 8. Hij moet dan automatisch de gegeven waarde
45,5 (in c2) vinden in de lijst (bijv met vlookup) en
vervolgens de waarde voorspellen. Ik kom er niet uit. Weet
jij dit soms ook?
Alvast bedankt
Rene
>-----Oorspronkelijk bericht-----
>.
>
Hier een VBA functie van Bill Koran
Groeten,
Niek Otten
=====================
Function InterpolateVLOOKUP(X As Double, Table As Range, _
YCol As Long) As Variant
Dim TableRow As Long
Dim x0 As Double, x1 As Double
Dim y0 As Double, y1 As Double
On Error GoTo ErrorFound
'type-mismatch error triggered if X smaller than Table(1, 1)
TableRow = Application.Match(X, Table.Columns(1), 1)
'subsequent assignment lines and calculations will trigger
'type-mismatch errors if table contains text at TableRow or TableRow + 1
x0 = Table(TableRow, 1)
y0 = Table(TableRow, YCol)
If x0 = X Then
'exact match on last X-value in the table is OK
InterpolateVLOOKUP = y0
ElseIf TableRow = Table.Rows.Count Then
'if the match is on the last row of the table,
'there's no TableRow + 1, and we can't interpolate
Err.Raise 13
Else
x1 = Table(TableRow + 1, 1)
y1 = Table(TableRow + 1, YCol)
InterpolateVLOOKUP = (X - x0) / (x1 - x0) * (y1 - y0) + y0
End If
Exit Function
ErrorFound:
InterpolateVLOOKUP = CVErr(xlErrNum)
End Function 'InterpolateVLOOKUP
=============================================
"Rene" <re...@nieboer.net> wrote in message
news:070901c14509$aa76f730$b1e62ecf@tkmsftngxa04...
"rene" <re...@nieboer.net> schreef in bericht
news:317601c1452d$16477070$9ae62ecf@tkmsftngxa02...