|
こんばんは、Takao さん
FORECAST(存在すら知らなかった関数です)とは、結果が異なりますけど・・・
平均から算出がB列に、差から算出がC列に出ます。
>199KNの場合、表の100〜200KNの間になるわけですが、2つの平均もしくは差で出す
という意味を取り違えてるかも
Sub test_0()
Dim i As Long
Dim strMpa As String, dblMpa As Double
Dim mRng As Range, cRng As Range, cR As Range
Dim aveD As Double, depD As Double
Set mRng = Range("A1").CurrentRegion.Rows(1)
Set cRng = Range("A4", Range("A65536").End(xlUp))
For Each cR In cRng
i = Application.Match(cR.Value, mRng, 1)
If Cells(1, i) = 0 Then
cR(1, 2) = Cells(2, i + 1) / Cells(1, i + 1) * cR.Value
Else
cR(1, 2) = _
((Cells(2, i) / Cells(1, i)) + (Cells(2, i + 1) _
/ Cells(1, i + 1))) / 2 * cR.Value
End If
cR(1, 3) = (Cells(2, i + 1) - Cells(2, i)) _
/ (Cells(1, i + 1) - Cells(1, i)) * cR.Value
Next
Set mRng = Nothing
Set cRng = Nothing
End Sub
|
|