From 4c73ab5f5cc87ec693fd7de0c5998e20d13e9058 Mon Sep 17 00:00:00 2001 From: Trowbridge Date: Fri, 15 Mar 2019 11:10:33 -0400 Subject: [PATCH] cascade price instead of populating with average --- handler.bas | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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