wie bekomme ich es hin, das meine Formel Interpolieren_Spalten_linear_Matrix auch die gesamten Werte sihtbar ausgibt!!!
Siehe meine Beispieldatei!
https://www.herber.de/bbs/user/33013.xls
Vielen Dank für schnelle Hilfe!
Die Codes für die Fuktionen hier:
Function Interpolieren_Spalten_linear_Matrix(X_Werte As Object, Y_Werte As Object, X As Variant)
Dim rng As Range
Dim y
Dim i%
ReDim y(1 To X.Cells.Count)
For Each rng In X.Cells
i = i + 1
y(i) = Interpolation_Spalten_linear(X_Werte, Y_Werte, rng)
Next
Interpolieren_Spalten_linear_Matrix = y
End Function
Public
Function Interpolation_Spalten_linear(X_Werte As Object, Y_Werte As Object, X As Variant) As Double
Dim n As Long, ind As Long, i As Long
n = X_Werte.Rows.Count
If X < X_Werte(1) Then
Interpolation_Spalten_linear = Y_Werte(1)
ElseIf X > X_Werte(n) Then
Interpolation_Spalten_linear = Y_Werte(n)
Else
For i = 1 To n
If X_Werte(i) <= X Then
ind = ind + 1
Else
ind = ind
End If
Next
Dim X1 As Variant, X2 As Variant, Y1 As Double, Y2 As Double
X1 = X_Werte(ind)
X2 = X_Werte(ind + 1)
Y1 = Y_Werte(ind)
Y2 = Y_Werte(ind + 1)
Interpolation_Spalten_linear = (Y1 * (X2 - X) + Y2 * (X - X1)) / (X2 - X1)
End If
End Function