cascade price instead of populating with average

This commit is contained in:
Trowbridge 2019-03-15 11:10:33 -04:00
parent 75af4275f2
commit 4c73ab5f5c

View File

@ -366,7 +366,14 @@ Sub month_tosheet(ByRef pkg() As Variant)
'--base--
If co_num(pkg(i, 2), 0) = 0 Then
sh.Cells(i + 1, 7) = 0
'if there is no monthly base volume,
'then use the prior price, if there was no prior price,
'then inherit the average price for the year before current adjustments
If sh.Cells(i, 7) <> 0 Then
sh.Cells(i + 1, 7) = sh.Cells(i, 7)
Else
sh.Cells(i + 1, 7) = (pkg(13, 5) + pkg(13, 6)) / (pkg(13, 1) + pkg(13, 2))
End If
Else
sh.Cells(i + 1, 7) = pkg(i, 6) / pkg(i, 2)
End If
@ -383,7 +390,14 @@ Sub month_tosheet(ByRef pkg() As Variant)
'--forecast--
If co_num(pkg(i, 4), 0) = 0 Then
sh.Cells(i + 1, 10) = 0
'if there is no monthly base volume,
'then use the prior price, if there was no prior price,
'then inherit the average price for the year before current adjustments
If sh.Cells(i, 10) <> 0 Then
sh.Cells(i + 1, 10) = sh.Cells(i, 10)
Else
sh.Cells(i + 1, 10) = (pkg(13, 5) + pkg(13, 6)) / (pkg(13, 1) + pkg(13, 2))
End If
Else
sh.Cells(i + 1, 10) = pkg(i, 8) / pkg(i, 4)
End If