diff --git a/handler.bas b/handler.bas index df3e991..d3cfd4f 100644 --- a/handler.bas +++ b/handler.bas @@ -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