VBA Loop for each to build forecast

natekris8183

Board Regular
Joined
Mar 12, 2013
Messages
156
I have a data set that includes Column1 (Dates, week-to-week starting on Mondays), Column2 (product by SKU), Columns3 (product status, active... this will eventually be left out as soon as I finish the VBA to permit a list to be built allowing only active products to be selected in the data validation drop down), Column4 (Source: legacy or dealer). The SKUs are unique to the products obviously. I need to create a list range of data set to input into the Worksheet Function Trend based upon dates prior to the current date in the table range (RawSalesDataTbl[@Week]). This will provide a running trend to juxtapose against our proposed forecast. The complication is the data set is not linear thus I cannot simple name a range of "y" values and "x" values. The easy one is naming the proposed "X" value as it will be the next week value, again determined at RawSalesDataTbl[@Week].
 
Your actual data is pretty non-linear. Here is one of a few ways that I would try. First, I don't think you can use the date per se as a predictor. Second if you sum the acutal values and then take the ln of those values it will linearize the data somewhat. Also, do a chart comparing column a sheet 2 to column j sheet 2. I'll post the sheets, and macros. Hopefully it is self-explanatory. Sheet 1 contains the ln data and prediction intervals. Sheet 2 will contain the actual forecast (column J). Also, I have not carried down the forecast past row 99 as I can only post 100 rows. Hope you get the idea of what to do to your data. Also, not sure if I can post the chart here or if I can how to do it.

Sheet 1:

Excel 2012
ABCDEFGHIJKLM
1WeekActualForecastSmall Table of z-values for Confidence IntervalsLower PIUpper PI
212.3025852.302585SMOOTHINGDAMPINGTOTAL1.303.30
322.8903722.3025850.9000000950.09999991Confidence Levela1-(a/2)z1.303.30
433.2188762.8315935%0.950.5250.0627071.833.83
543.4657363.180148Prediction IntervalERRORRow Check10%0.900.550.1256612.184.18
653.6109183.43717799%0.150048715%0.850.5750.1891182.444.43
763.6375863.5935440.99777635220%0.800.60.2533472.604.59
873.7135723.63318225%0.750.6250.3186392.644.63
983.737673.70553330%0.700.650.385322.714.70
1093.9512443.73445635%0.650.6750.4537622.744.73
11104.0073333.929565SMOOTHINGERROR40%0.600.70.5244012.934.93
12114.1108743.9995560.1000000010.932123145%0.550.7250.597763.005.00
13124.1271344.0997420.2000000030.511330350%0.500.750.674493.105.10
14134.1743874.1243950.3000000120.360571355%0.450.7750.7554153.135.12
15144.4543474.1693880.4000000060.282651460%0.400.80.8416213.175.17
16154.5747114.4258510.50.234940765%0.350.8250.9345893.435.42
17164.6249734.5598250.6000000240.202829370%0.300.851.0364333.565.56
18174.6728294.6184580.7000000480.17991875%0.250.8751.1503493.625.62
19184.7621744.6673920.8000000720.162939380%0.200.91.2815523.675.67
20195.1179944.7526960.9000000950.150048785%0.150.9251.4395313.755.75
21205.4116465.08146490%0.100.951.6448544.086.08
22215.552965.37862892%0.080.961.7506864.386.38
23225.7268485.53552695%0.050.9751.9599644.546.53
24236.3699015.70771696%0.040.982.0537494.716.71
25246.6280416.30368398%0.020.992.3263485.317.30
26256.8308746.59560699%0.010.9952.5758295.607.59
27267.0039746.80734799.9%0.0010.99953.2905275.817.81
28277.3907996.98431199.99%0.00010.999953.8905925.997.98
29287.3926487.350156.358.35
30297.4277397.3883986.398.39
31307.4662287.4238056.438.42
32317.4888537.4619856.468.46
33327.5202357.4861666.498.48
34337.681567.5168286.528.51
35347.7698017.6650876.678.66
36357.8501047.759336.768.76
37367.9266037.8410266.848.84
38378.1247437.9180456.928.92
39388.1259278.1040737.119.10
40398.1429368.1237417.139.12
41408.1619468.1410177.149.14
42418.1732938.1598537.169.16
43428.1892458.1719497.179.17
44438.2751228.1875157.199.19
45448.3248218.2663617.279.26
46458.3717058.3189757.329.32
47468.4178158.3664327.379.36
48478.543648.4126767.419.41
49488.5444198.5305447.539.53
50498.5486928.5430327.559.54
51508.6097728.5481267.559.55
52518.6961768.6036087.619.60
53528.7699738.6869197.699.68
54538.8472168.7616687.769.76
55548.9648238.8386617.849.84
56559.0538048.9522077.959.95
57569.1325959.0436448.0510.04
58579.211449.12378.1310.12
59589.4000519.2026668.2010.20
60599.4011269.3803138.3810.38
61609.4012919.3990458.4010.40
62619.4159719.4010678.4010.40
63629.4331649.4144818.4210.41
64639.442889.4312968.4310.43
65649.4564979.4417218.4410.44
66659.5329319.4550198.4610.45
67669.5767879.525148.5310.52
68679.6211259.5716238.5710.57
69689.6624359.6161748.6210.61
70699.7704139.6578098.6610.66
71709.7710989.7591538.7610.76
72719.7726959.7699048.7710.77
73729.7758259.7724168.7710.77
74739.7825069.7754848.7810.77
75749.7855489.7818038.7810.78
76759.7930039.7851748.7910.78
77769.7960699.792228.7910.79
78779.8027289.7956848.8010.79
79789.8052139.8020238.8010.80
80799.8303799.8048948.8110.80
81809.8311329.8278318.8310.83
82819.8395369.8308028.8310.83
83829.8467069.8386628.8410.84
84839.8544029.8459018.8510.84
85849.8612589.8535528.8610.85
86859.8893389.8604888.8610.86
87869.9254459.8864538.8910.88
88879.9386139.9215468.9210.92
89889.97329.9369078.9410.93
908910.065869.9695718.9710.97
919010.0668410.056239.0611.05
929110.0672610.065789.0711.06
939210.0700210.067119.0711.06
949310.0747110.069739.0711.07
959410.0760510.074219.0811.07
969510.0793710.075879.0811.07
979610.1026710.079029.0811.08
989710.1067110.10039.1011.10
999810.1074110.106079.1111.10
Sheet1
Cell Formulas
RangeFormula
L2=C2-$E$7
L3=C3-$E$7
L4=C4-$E$7
L5=C5-$E$7
L6=C6-$E$7
L7=C7-$E$7
L8=C8-$E$7
L9=C9-$E$7
L10=C10-$E$7
L11=C11-$E$7
L12=C12-$E$7
L13=C13-$E$7
L14=C14-$E$7
L15=C15-$E$7
L16=C16-$E$7
L17=C17-$E$7
L18=C18-$E$7
L19=C19-$E$7
L20=C20-$E$7
L21=C21-$E$7
L22=C22-$E$7
L23=C23-$E$7
L24=C24-$E$7
L25=C25-$E$7
L26=C26-$E$7
L27=C27-$E$7
L28=C28-$E$7
L29=C29-$E$7
L30=C30-$E$7
L31=C31-$E$7
L32=C32-$E$7
L33=C33-$E$7
L34=C34-$E$7
L35=C35-$E$7
L36=C36-$E$7
L37=C37-$E$7
L38=C38-$E$7
L39=C39-$E$7
L40=C40-$E$7
L41=C41-$E$7
L42=C42-$E$7
L43=C43-$E$7
L44=C44-$E$7
L45=C45-$E$7
L46=C46-$E$7
L47=C47-$E$7
L48=C48-$E$7
L49=C49-$E$7
L50=C50-$E$7
L51=C51-$E$7
L52=C52-$E$7
L53=C53-$E$7
L54=C54-$E$7
L55=C55-$E$7
L56=C56-$E$7
L57=C57-$E$7
L58=C58-$E$7
L59=C59-$E$7
L60=C60-$E$7
L61=C61-$E$7
L62=C62-$E$7
L63=C63-$E$7
L64=C64-$E$7
L65=C65-$E$7
L66=C66-$E$7
L67=C67-$E$7
L68=C68-$E$7
L69=C69-$E$7
L70=C70-$E$7
L71=C71-$E$7
L72=C72-$E$7
L73=C73-$E$7
L74=C74-$E$7
L75=C75-$E$7
L76=C76-$E$7
L77=C77-$E$7
L78=C78-$E$7
L79=C79-$E$7
L80=C80-$E$7
L81=C81-$E$7
L82=C82-$E$7
L83=C83-$E$7
L84=C84-$E$7
L85=C85-$E$7
L86=C86-$E$7
L87=C87-$E$7
L88=C88-$E$7
L89=C89-$E$7
L90=C90-$E$7
L91=C91-$E$7
L92=C92-$E$7
L93=C93-$E$7
L94=C94-$E$7
L95=C95-$E$7
L96=C96-$E$7
L97=C97-$E$7
L98=C98-$E$7
L99=C99-$E$7
M2=C2+$E$7
M3=C3+$E$7
M4=C4+$E$7
M5=C5+$E$7
M6=C6+$E$7
M7=C7+$E$7
M8=C8+$E$7
M9=C9+$E$7
M10=C10+$E$7
M11=C11+$E$7
M12=C12+$E$7
M13=C13+$E$7
M14=C14+$E$7
M15=C15+$E$7
M16=C16+$E$7
M17=C17+$E$7
M18=C18+$E$7
M19=C19+$E$7
M20=C20+$E$7
M21=C21+$E$7
M22=C22+$E$7
M23=C23+$E$7
M24=C24+$E$7
M25=C25+$E$7
M26=C26+$E$7
M27=C27+$E$7
M28=C28+$E$7
M29=C29+$E$7
M30=C30+$E$7
M31=C31+$E$7
M32=C32+$E$7
M33=C33+$E$7
M34=C34+$E$7
M35=C35+$E$7
M36=C36+$E$7
M37=C37+$E$7
M38=C38+$E$7
M39=C39+$E$7
M40=C40+$E$7
M41=C41+$E$7
M42=C42+$E$7
M43=C43+$E$7
M44=C44+$E$7
M45=C45+$E$7
M46=C46+$E$7
M47=C47+$E$7
M48=C48+$E$7
M49=C49+$E$7
M50=C50+$E$7
M51=C51+$E$7
M52=C52+$E$7
M53=C53+$E$7
M54=C54+$E$7
M55=C55+$E$7
M56=C56+$E$7
M57=C57+$E$7
M58=C58+$E$7
M59=C59+$E$7
M60=C60+$E$7
M61=C61+$E$7
M62=C62+$E$7
M63=C63+$E$7
M64=C64+$E$7
M65=C65+$E$7
M66=C66+$E$7
M67=C67+$E$7
M68=C68+$E$7
M69=C69+$E$7
M70=C70+$E$7
M71=C71+$E$7
M72=C72+$E$7
M73=C73+$E$7
M74=C74+$E$7
M75=C75+$E$7
M76=C76+$E$7
M77=C77+$E$7
M78=C78+$E$7
M79=C79+$E$7
M80=C80+$E$7
M81=C81+$E$7
M82=C82+$E$7
M83=C83+$E$7
M84=C84+$E$7
M85=C85+$E$7
M86=C86+$E$7
M87=C87+$E$7
M88=C88+$E$7
M89=C89+$E$7
M90=C90+$E$7
M91=C91+$E$7
M92=C92+$E$7
M93=C93+$E$7
M94=C94+$E$7
M95=C95+$E$7
M96=C96+$E$7
M97=C97+$E$7
M98=C98+$E$7
M99=C99+$E$7
F3=1-E3
G3=SUM(E3:F3)
I4=1-H4
I5=1-H5
I6=1-H6
I7=1-H7
I8=1-H8
I9=1-H9
I10=1-H10
I11=1-H11
I12=1-H12
I13=1-H13
I14=1-H14
I15=1-H15
I16=1-H16
I17=1-H17
I18=1-H18
I19=1-H19
I20=1-H20
I21=1-H21
I22=1-H22
I23=1-H23
I24=1-H24
I25=1-H25
I26=1-H26
I27=1-H27
I28=1-H28
J4=1-(I4/2)
J5=1-(I5/2)
J6=1-(I6/2)
J7=1-(I7/2)
J8=1-(I8/2)
J9=1-(I9/2)
J10=1-(I10/2)
J11=1-(I11/2)
J12=1-(I12/2)
J13=1-(I13/2)
J14=1-(I14/2)
J15=1-(I15/2)
J16=1-(I16/2)
J17=1-(I17/2)
J18=1-(I18/2)
J19=1-(I19/2)
J20=1-(I20/2)
J21=1-(I21/2)
J22=1-(I22/2)
J23=1-(I23/2)
J24=1-(I24/2)
J25=1-(I25/2)
J26=1-(I26/2)
J27=1-(I27/2)
J28=1-(I28/2)
K4=NORMSINV(J4)
K5=NORMSINV(J5)
K6=NORMSINV(J6)
K7=NORMSINV(J7)
K8=NORMSINV(J8)
K9=NORMSINV(J9)
K10=NORMSINV(J10)
K11=NORMSINV(J11)
K12=NORMSINV(J12)
K13=NORMSINV(J13)
K14=NORMSINV(J14)
K15=NORMSINV(J15)
K16=NORMSINV(J16)
K17=NORMSINV(J17)
K18=NORMSINV(J18)
K19=NORMSINV(J19)
K20=NORMSINV(J20)
K21=NORMSINV(J21)
K22=NORMSINV(J22)
K23=NORMSINV(J23)
K24=NORMSINV(J24)
K25=NORMSINV(J25)
K26=NORMSINV(J26)
K27=NORMSINV(J27)
K28=NORMSINV(J28)
E7=VLOOKUP($E$6,$H$4:$K$28,4,FALSE)*SQRT(F6)
C2=B2
C3=B2
C4=$E$3*B3+$F$3*C3
C5=$E$3*B4+$F$3*C4
C6=$E$3*B5+$F$3*C5
C7=$E$3*B6+$F$3*C6
C8=$E$3*B7+$F$3*C7
C9=$E$3*B8+$F$3*C8
C10=$E$3*B9+$F$3*C9
C11=$E$3*B10+$F$3*C10
C12=$E$3*B11+$F$3*C11
C13=$E$3*B12+$F$3*C12
C14=$E$3*B13+$F$3*C13
C15=$E$3*B14+$F$3*C14
C16=$E$3*B15+$F$3*C15
C17=$E$3*B16+$F$3*C16
C18=$E$3*B17+$F$3*C17
C19=$E$3*B18+$F$3*C18
C20=$E$3*B19+$F$3*C19
C21=$E$3*B20+$F$3*C20
C22=$E$3*B21+$F$3*C21
C23=$E$3*B22+$F$3*C22
C24=$E$3*B23+$F$3*C23
C25=$E$3*B24+$F$3*C24
C26=$E$3*B25+$F$3*C25
C27=$E$3*B26+$F$3*C26
C28=$E$3*B27+$F$3*C27
C29=$E$3*B28+$F$3*C28
C30=$E$3*B29+$F$3*C29
C31=$E$3*B30+$F$3*C30
C32=$E$3*B31+$F$3*C31
C33=$E$3*B32+$F$3*C32
C34=$E$3*B33+$F$3*C33
C35=$E$3*B34+$F$3*C34
C36=$E$3*B35+$F$3*C35
C37=$E$3*B36+$F$3*C36
C38=$E$3*B37+$F$3*C37
C39=$E$3*B38+$F$3*C38
C40=$E$3*B39+$F$3*C39
C41=$E$3*B40+$F$3*C40
C42=$E$3*B41+$F$3*C41
C43=$E$3*B42+$F$3*C42
C44=$E$3*B43+$F$3*C43
C45=$E$3*B44+$F$3*C44
C46=$E$3*B45+$F$3*C45
C47=$E$3*B46+$F$3*C46
C48=$E$3*B47+$F$3*C47
C49=$E$3*B48+$F$3*C48
C50=$E$3*B49+$F$3*C49
C51=$E$3*B50+$F$3*C50
C52=$E$3*B51+$F$3*C51
C53=$E$3*B52+$F$3*C52
C54=$E$3*B53+$F$3*C53
C55=$E$3*B54+$F$3*C54
C56=$E$3*B55+$F$3*C55
C57=$E$3*B56+$F$3*C56
C58=$E$3*B57+$F$3*C57
C59=$E$3*B58+$F$3*C58
C60=$E$3*B59+$F$3*C59
C61=$E$3*B60+$F$3*C60
C62=$E$3*B61+$F$3*C61
C63=$E$3*B62+$F$3*C62
C64=$E$3*B63+$F$3*C63
C65=$E$3*B64+$F$3*C64
C66=$E$3*B65+$F$3*C65
C67=$E$3*B66+$F$3*C66
C68=$E$3*B67+$F$3*C67
C69=$E$3*B68+$F$3*C68
C70=$E$3*B69+$F$3*C69
C71=$E$3*B70+$F$3*C70
C72=$E$3*B71+$F$3*C71
C73=$E$3*B72+$F$3*C72
C74=$E$3*B73+$F$3*C73
C75=$E$3*B74+$F$3*C74
C76=$E$3*B75+$F$3*C75
C77=$E$3*B76+$F$3*C76
C78=$E$3*B77+$F$3*C77
C79=$E$3*B78+$F$3*C78
C80=$E$3*B79+$F$3*C79
C81=$E$3*B80+$F$3*C80
C82=$E$3*B81+$F$3*C81
C83=$E$3*B82+$F$3*C82
C84=$E$3*B83+$F$3*C83
C85=$E$3*B84+$F$3*C84
C86=$E$3*B85+$F$3*C85
C87=$E$3*B86+$F$3*C86
C88=$E$3*B87+$F$3*C87
C89=$E$3*B88+$F$3*C88
C90=$E$3*B89+$F$3*C89
C91=$E$3*B90+$F$3*C90
C92=$E$3*B91+$F$3*C91
C93=$E$3*B92+$F$3*C92
C94=$E$3*B93+$F$3*C93
C95=$E$3*B94+$F$3*C94
C96=$E$3*B95+$F$3*C95
C97=$E$3*B96+$F$3*C96
C98=$E$3*B97+$F$3*C97
C99=$E$3*B98+$F$3*C98


Sheet 2:

Excel 2012
ABCDEFGHIJK
1ActualSumLNLower PIForecastUpper PIActual Lower PIActual ForecastActual Upper PI
210102.30258541027-6017
38182.89037241027-1489
47253.21887661746-19821
57323.46573692465-23833
65373.610918113184-26647
71383.637586133699-25261
83413.7135721438103-27362
91423.737671541110-27168
1010523.9512441542114-371062
113554.0073331951138-36483
126614.1108742055148-41687
131624.1271342260164-402102
143654.1743872362168-423103
1521864.4543472465175-622189
1611974.5747113184227-6613130
1751024.6249733596259-676157
1851074.67282937101275-706168
19101174.76217439106289-7811172
20501675.11799443116314-12451147
21572245.41164659161437-16563213
22342585.5529680217588-17841330
23493075.72684893254688-21453381
242775846.369901111301817-473283233
251727566.6280412025471482-554209726
261709266.8308742707321985-6561941059
2717511017.0039743339042453-7681971352
2852016217.39079939810802928-12235411307
29316247.39264857415564221-1050682597
305816827.42773959616174386-1086652704
316617487.46622861816754544-1130732796
324017887.48885364217414721-1146472933
335718457.52023565717834836-1188622991
3432321687.6815667818394987-14903292819
3520023687.76980178621335784-15822353416
3619825667.85010486423436356-17022233790
3720427707.92660393825436897-18322274127
3860733778.124743101327467449-23646314072
39433818.125927122033088972-2161735591
405834398.142936124433749150-2195655711
416635058.161946126634329310-2239735805
424035458.173293129034989487-2255475942
435736028.189245130535409602-2297626000
4432339258.275122132635969753-25993295828
4520041258.3248211435389110553-26902346428
4619843238.3717051512410111123-28112226800
4720445278.4178151586430011663-29412277136
4860751348.543641661450412215-34736307081
49451388.5444191868506713743-3270718605
502251608.5486921892513113916-3268298756
5132554858.6097721901515713987-35843288502
5249559808.6961762010545114785-39705298805
5345864388.7699732185592516070-42535139632
5451769558.8472162354638517317-460157010362
5586878238.9648232542689618703-528192710880
5672885519.0538042848772520952-570382612401
5770192529.1325953121846522958-613178713706
58759100119.211443381917024871-663084114860
592078120899.4000513659992426915-8430216514826
6013121029.40112643701185332147-773224920045
612121049.40129144531207732755-76512720651
62179122839.41597144621210132822-782118220539
63213124969.43316445221226533265-797423120769
64122126189.4428845991247333829-801914521211
65173127919.45649746471260334183-814418821392
661016138079.53293147091277234641-9098103520834
67619144269.57678750511370037157-937572622731
68654150809.62112552911435238925-978972823845
69636157169.66243555331500640699-1018371024983
701792175089.77041357681564342429-11740186524921
7112175209.77109863831731246954-1113720829434
7228175489.77269564521749947462-110964929914
7355176039.77582564681754347581-111356029978
74118177219.78250664881759747727-1123312430006
7554177759.78554865291770948030-112466630255
76133179089.79300365511776848192-1135714030284
7755179639.79606965971789448533-113666930570
78120180839.80272866201795648701-1146312730618
7945181289.80521366621807049011-114665830883
80462185909.83037966821812249152-1190846830562
8114186049.83113268371854350292-117676131688
82157187619.83953668571859850442-1190416331681
83135188969.84670669111874550840-1198515131944
84146190429.85440269611888151209-1208116132167
85131191739.86125870151902651603-1215814732430
86546197199.88933870641915851962-1265556132243
87725204449.92544572491966253329-1319578232885
88271207159.93861375082036455233-1320735134518
89729214449.973276252068056088-1381976434644
9020822352610.0658678782136657951-15648216034425
91232354910.0668485912330163197-1495824839648
92102355910.0672686732352463803-148863540244
93652362410.0700286852355663888-149396840264
941112373510.0747187082361764055-1502711840320
95322376710.0760587472372364343-150204440576
96792384610.0793787612376364450-150858340604
975622440810.1026787892383864654-1561957040246
98992450710.1067189782435066044-1552915741537
99172452410.1074190302449166426-154943341902
Sheet2
Cell Formulas
RangeFormula
B2=SUM($A$2:A2)
B3=SUM($A$2:A3)
B4=SUM($A$2:A4)
B5=SUM($A$2:A5)
B6=SUM($A$2:A6)
B7=SUM($A$2:A7)
B8=SUM($A$2:A8)
B9=SUM($A$2:A9)
B10=SUM($A$2:A10)
B11=SUM($A$2:A11)
B12=SUM($A$2:A12)
B13=SUM($A$2:A13)
B14=SUM($A$2:A14)
B15=SUM($A$2:A15)
B16=SUM($A$2:A16)
B17=SUM($A$2:A17)
B18=SUM($A$2:A18)
B19=SUM($A$2:A19)
B20=SUM($A$2:A20)
B21=SUM($A$2:A21)
B22=SUM($A$2:A22)
B23=SUM($A$2:A23)
B24=SUM($A$2:A24)
B25=SUM($A$2:A25)
B26=SUM($A$2:A26)
B27=SUM($A$2:A27)
B28=SUM($A$2:A28)
B29=SUM($A$2:A29)
B30=SUM($A$2:A30)
B31=SUM($A$2:A31)
B32=SUM($A$2:A32)
B33=SUM($A$2:A33)
B34=SUM($A$2:A34)
B35=SUM($A$2:A35)
B36=SUM($A$2:A36)
B37=SUM($A$2:A37)
B38=SUM($A$2:A38)
B39=SUM($A$2:A39)
B40=SUM($A$2:A40)
B41=SUM($A$2:A41)
B42=SUM($A$2:A42)
B43=SUM($A$2:A43)
B44=SUM($A$2:A44)
B45=SUM($A$2:A45)
B46=SUM($A$2:A46)
B47=SUM($A$2:A47)
B48=SUM($A$2:A48)
B49=SUM($A$2:A49)
B50=SUM($A$2:A50)
B51=SUM($A$2:A51)
B52=SUM($A$2:A52)
B53=SUM($A$2:A53)
B54=SUM($A$2:A54)
B55=SUM($A$2:A55)
B56=SUM($A$2:A56)
B57=SUM($A$2:A57)
B58=SUM($A$2:A58)
B59=SUM($A$2:A59)
B60=SUM($A$2:A60)
B61=SUM($A$2:A61)
B62=SUM($A$2:A62)
B63=SUM($A$2:A63)
B64=SUM($A$2:A64)
B65=SUM($A$2:A65)
B66=SUM($A$2:A66)
B67=SUM($A$2:A67)
B68=SUM($A$2:A68)
B69=SUM($A$2:A69)
B70=SUM($A$2:A70)
B71=SUM($A$2:A71)
B72=SUM($A$2:A72)
B73=SUM($A$2:A73)
B74=SUM($A$2:A74)
B75=SUM($A$2:A75)
B76=SUM($A$2:A76)
B77=SUM($A$2:A77)
B78=SUM($A$2:A78)
B79=SUM($A$2:A79)
B80=SUM($A$2:A80)
B81=SUM($A$2:A81)
B82=SUM($A$2:A82)
B83=SUM($A$2:A83)
B84=SUM($A$2:A84)
B85=SUM($A$2:A85)
B86=SUM($A$2:A86)
B87=SUM($A$2:A87)
B88=SUM($A$2:A88)
B89=SUM($A$2:A89)
B90=SUM($A$2:A90)
B91=SUM($A$2:A91)
B92=SUM($A$2:A92)
B93=SUM($A$2:A93)
B94=SUM($A$2:A94)
B95=SUM($A$2:A95)
B96=SUM($A$2:A96)
B97=SUM($A$2:A97)
B98=SUM($A$2:A98)
B99=SUM($A$2:A99)
C2=LN(B2)
C3=LN(B3)
C4=LN(B4)
C5=LN(B5)
C6=LN(B6)
C7=LN(B7)
C8=LN(B8)
C9=LN(B9)
C10=LN(B10)
C11=LN(B11)
C12=LN(B12)
C13=LN(B13)
C14=LN(B14)
C15=LN(B15)
C16=LN(B16)
C17=LN(B17)
C18=LN(B18)
C19=LN(B19)
C20=LN(B20)
C21=LN(B21)
C22=LN(B22)
C23=LN(B23)
C24=LN(B24)
C25=LN(B25)
C26=LN(B26)
C27=LN(B27)
C28=LN(B28)
C29=LN(B29)
C30=LN(B30)
C31=LN(B31)
C32=LN(B32)
C33=LN(B33)
C34=LN(B34)
C35=LN(B35)
C36=LN(B36)
C37=LN(B37)
C38=LN(B38)
C39=LN(B39)
C40=LN(B40)
C41=LN(B41)
C42=LN(B42)
C43=LN(B43)
C44=LN(B44)
C45=LN(B45)
C46=LN(B46)
C47=LN(B47)
C48=LN(B48)
C49=LN(B49)
C50=LN(B50)
C51=LN(B51)
C52=LN(B52)
C53=LN(B53)
C54=LN(B54)
C55=LN(B55)
C56=LN(B56)
C57=LN(B57)
C58=LN(B58)
C59=LN(B59)
C60=LN(B60)
C61=LN(B61)
C62=LN(B62)
C63=LN(B63)
C64=LN(B64)
C65=LN(B65)
C66=LN(B66)
C67=LN(B67)
C68=LN(B68)
C69=LN(B69)
C70=LN(B70)
C71=LN(B71)
C72=LN(B72)
C73=LN(B73)
C74=LN(B74)
C75=LN(B75)
C76=LN(B76)
C77=LN(B77)
C78=LN(B78)
C79=LN(B79)
C80=LN(B80)
C81=LN(B81)
C82=LN(B82)
C83=LN(B83)
C84=LN(B84)
C85=LN(B85)
C86=LN(B86)
C87=LN(B87)
C88=LN(B88)
C89=LN(B89)
C90=LN(B90)
C91=LN(B91)
C92=LN(B92)
C93=LN(B93)
C94=LN(B94)
C95=LN(B95)
C96=LN(B96)
C97=LN(B97)
C98=LN(B98)
C99=LN(B99)
E2=ROUND(EXP(Sheet1!L2),0)
E3=ROUND(EXP(Sheet1!L3),0)
E4=ROUND(EXP(Sheet1!L4),0)
E5=ROUND(EXP(Sheet1!L5),0)
E6=ROUND(EXP(Sheet1!L6),0)
E7=ROUND(EXP(Sheet1!L7),0)
E8=ROUND(EXP(Sheet1!L8),0)
E9=ROUND(EXP(Sheet1!L9),0)
E10=ROUND(EXP(Sheet1!L10),0)
E11=ROUND(EXP(Sheet1!L11),0)
E12=ROUND(EXP(Sheet1!L12),0)
E13=ROUND(EXP(Sheet1!L13),0)
E14=ROUND(EXP(Sheet1!L14),0)
E15=ROUND(EXP(Sheet1!L15),0)
E16=ROUND(EXP(Sheet1!L16),0)
E17=ROUND(EXP(Sheet1!L17),0)
E18=ROUND(EXP(Sheet1!L18),0)
E19=ROUND(EXP(Sheet1!L19),0)
E20=ROUND(EXP(Sheet1!L20),0)
E21=ROUND(EXP(Sheet1!L21),0)
E22=ROUND(EXP(Sheet1!L22),0)
E23=ROUND(EXP(Sheet1!L23),0)
E24=ROUND(EXP(Sheet1!L24),0)
E25=ROUND(EXP(Sheet1!L25),0)
E26=ROUND(EXP(Sheet1!L26),0)
E27=ROUND(EXP(Sheet1!L27),0)
E28=ROUND(EXP(Sheet1!L28),0)
E29=ROUND(EXP(Sheet1!L29),0)
E30=ROUND(EXP(Sheet1!L30),0)
E31=ROUND(EXP(Sheet1!L31),0)
E32=ROUND(EXP(Sheet1!L32),0)
E33=ROUND(EXP(Sheet1!L33),0)
E34=ROUND(EXP(Sheet1!L34),0)
E35=ROUND(EXP(Sheet1!L35),0)
E36=ROUND(EXP(Sheet1!L36),0)
E37=ROUND(EXP(Sheet1!L37),0)
E38=ROUND(EXP(Sheet1!L38),0)
E39=ROUND(EXP(Sheet1!L39),0)
E40=ROUND(EXP(Sheet1!L40),0)
E41=ROUND(EXP(Sheet1!L41),0)
E42=ROUND(EXP(Sheet1!L42),0)
E43=ROUND(EXP(Sheet1!L43),0)
E44=ROUND(EXP(Sheet1!L44),0)
E45=ROUND(EXP(Sheet1!L45),0)
E46=ROUND(EXP(Sheet1!L46),0)
E47=ROUND(EXP(Sheet1!L47),0)
E48=ROUND(EXP(Sheet1!L48),0)
E49=ROUND(EXP(Sheet1!L49),0)
E50=ROUND(EXP(Sheet1!L50),0)
E51=ROUND(EXP(Sheet1!L51),0)
E52=ROUND(EXP(Sheet1!L52),0)
E53=ROUND(EXP(Sheet1!L53),0)
E54=ROUND(EXP(Sheet1!L54),0)
E55=ROUND(EXP(Sheet1!L55),0)
E56=ROUND(EXP(Sheet1!L56),0)
E57=ROUND(EXP(Sheet1!L57),0)
E58=ROUND(EXP(Sheet1!L58),0)
E59=ROUND(EXP(Sheet1!L59),0)
E60=ROUND(EXP(Sheet1!L60),0)
E61=ROUND(EXP(Sheet1!L61),0)
E62=ROUND(EXP(Sheet1!L62),0)
E63=ROUND(EXP(Sheet1!L63),0)
E64=ROUND(EXP(Sheet1!L64),0)
E65=ROUND(EXP(Sheet1!L65),0)
E66=ROUND(EXP(Sheet1!L66),0)
E67=ROUND(EXP(Sheet1!L67),0)
E68=ROUND(EXP(Sheet1!L68),0)
E69=ROUND(EXP(Sheet1!L69),0)
E70=ROUND(EXP(Sheet1!L70),0)
E71=ROUND(EXP(Sheet1!L71),0)
E72=ROUND(EXP(Sheet1!L72),0)
E73=ROUND(EXP(Sheet1!L73),0)
E74=ROUND(EXP(Sheet1!L74),0)
E75=ROUND(EXP(Sheet1!L75),0)
E76=ROUND(EXP(Sheet1!L76),0)
E77=ROUND(EXP(Sheet1!L77),0)
E78=ROUND(EXP(Sheet1!L78),0)
E79=ROUND(EXP(Sheet1!L79),0)
E80=ROUND(EXP(Sheet1!L80),0)
E81=ROUND(EXP(Sheet1!L81),0)
E82=ROUND(EXP(Sheet1!L82),0)
E83=ROUND(EXP(Sheet1!L83),0)
E84=ROUND(EXP(Sheet1!L84),0)
E85=ROUND(EXP(Sheet1!L85),0)
E86=ROUND(EXP(Sheet1!L86),0)
E87=ROUND(EXP(Sheet1!L87),0)
E88=ROUND(EXP(Sheet1!L88),0)
E89=ROUND(EXP(Sheet1!L89),0)
E90=ROUND(EXP(Sheet1!L90),0)
E91=ROUND(EXP(Sheet1!L91),0)
E92=ROUND(EXP(Sheet1!L92),0)
E93=ROUND(EXP(Sheet1!L93),0)
E94=ROUND(EXP(Sheet1!L94),0)
E95=ROUND(EXP(Sheet1!L95),0)
E96=ROUND(EXP(Sheet1!L96),0)
E97=ROUND(EXP(Sheet1!L97),0)
E98=ROUND(EXP(Sheet1!L98),0)
E99=ROUND(EXP(Sheet1!L99),0)
F2=ROUND(EXP(Sheet1!C2),0)
F3=ROUND(EXP(Sheet1!C3),0)
F4=ROUND(EXP(Sheet1!C4),0)
F5=ROUND(EXP(Sheet1!C5),0)
F6=ROUND(EXP(Sheet1!C6),0)
F7=ROUND(EXP(Sheet1!C7),0)
F8=ROUND(EXP(Sheet1!C8),0)
F9=ROUND(EXP(Sheet1!C9),0)
F10=ROUND(EXP(Sheet1!C10),0)
F11=ROUND(EXP(Sheet1!C11),0)
F12=ROUND(EXP(Sheet1!C12),0)
F13=ROUND(EXP(Sheet1!C13),0)
F14=ROUND(EXP(Sheet1!C14),0)
F15=ROUND(EXP(Sheet1!C15),0)
F16=ROUND(EXP(Sheet1!C16),0)
F17=ROUND(EXP(Sheet1!C17),0)
F18=ROUND(EXP(Sheet1!C18),0)
F19=ROUND(EXP(Sheet1!C19),0)
F20=ROUND(EXP(Sheet1!C20),0)
F21=ROUND(EXP(Sheet1!C21),0)
F22=ROUND(EXP(Sheet1!C22),0)
F23=ROUND(EXP(Sheet1!C23),0)
F24=ROUND(EXP(Sheet1!C24),0)
F25=ROUND(EXP(Sheet1!C25),0)
F26=ROUND(EXP(Sheet1!C26),0)
F27=ROUND(EXP(Sheet1!C27),0)
F28=ROUND(EXP(Sheet1!C28),0)
F29=ROUND(EXP(Sheet1!C29),0)
F30=ROUND(EXP(Sheet1!C30),0)
F31=ROUND(EXP(Sheet1!C31),0)
F32=ROUND(EXP(Sheet1!C32),0)
F33=ROUND(EXP(Sheet1!C33),0)
F34=ROUND(EXP(Sheet1!C34),0)
F35=ROUND(EXP(Sheet1!C35),0)
F36=ROUND(EXP(Sheet1!C36),0)
F37=ROUND(EXP(Sheet1!C37),0)
F38=ROUND(EXP(Sheet1!C38),0)
F39=ROUND(EXP(Sheet1!C39),0)
F40=ROUND(EXP(Sheet1!C40),0)
F41=ROUND(EXP(Sheet1!C41),0)
F42=ROUND(EXP(Sheet1!C42),0)
F43=ROUND(EXP(Sheet1!C43),0)
F44=ROUND(EXP(Sheet1!C44),0)
F45=ROUND(EXP(Sheet1!C45),0)
F46=ROUND(EXP(Sheet1!C46),0)
F47=ROUND(EXP(Sheet1!C47),0)
F48=ROUND(EXP(Sheet1!C48),0)
F49=ROUND(EXP(Sheet1!C49),0)
F50=ROUND(EXP(Sheet1!C50),0)
F51=ROUND(EXP(Sheet1!C51),0)
F52=ROUND(EXP(Sheet1!C52),0)
F53=ROUND(EXP(Sheet1!C53),0)
F54=ROUND(EXP(Sheet1!C54),0)
F55=ROUND(EXP(Sheet1!C55),0)
F56=ROUND(EXP(Sheet1!C56),0)
F57=ROUND(EXP(Sheet1!C57),0)
F58=ROUND(EXP(Sheet1!C58),0)
F59=ROUND(EXP(Sheet1!C59),0)
F60=ROUND(EXP(Sheet1!C60),0)
F61=ROUND(EXP(Sheet1!C61),0)
F62=ROUND(EXP(Sheet1!C62),0)
F63=ROUND(EXP(Sheet1!C63),0)
F64=ROUND(EXP(Sheet1!C64),0)
F65=ROUND(EXP(Sheet1!C65),0)
F66=ROUND(EXP(Sheet1!C66),0)
F67=ROUND(EXP(Sheet1!C67),0)
F68=ROUND(EXP(Sheet1!C68),0)
F69=ROUND(EXP(Sheet1!C69),0)
F70=ROUND(EXP(Sheet1!C70),0)
F71=ROUND(EXP(Sheet1!C71),0)
F72=ROUND(EXP(Sheet1!C72),0)
F73=ROUND(EXP(Sheet1!C73),0)
F74=ROUND(EXP(Sheet1!C74),0)
F75=ROUND(EXP(Sheet1!C75),0)
F76=ROUND(EXP(Sheet1!C76),0)
F77=ROUND(EXP(Sheet1!C77),0)
F78=ROUND(EXP(Sheet1!C78),0)
F79=ROUND(EXP(Sheet1!C79),0)
F80=ROUND(EXP(Sheet1!C80),0)
F81=ROUND(EXP(Sheet1!C81),0)
F82=ROUND(EXP(Sheet1!C82),0)
F83=ROUND(EXP(Sheet1!C83),0)
F84=ROUND(EXP(Sheet1!C84),0)
F85=ROUND(EXP(Sheet1!C85),0)
F86=ROUND(EXP(Sheet1!C86),0)
F87=ROUND(EXP(Sheet1!C87),0)
F88=ROUND(EXP(Sheet1!C88),0)
F89=ROUND(EXP(Sheet1!C89),0)
F90=ROUND(EXP(Sheet1!C90),0)
F91=ROUND(EXP(Sheet1!C91),0)
F92=ROUND(EXP(Sheet1!C92),0)
F93=ROUND(EXP(Sheet1!C93),0)
F94=ROUND(EXP(Sheet1!C94),0)
F95=ROUND(EXP(Sheet1!C95),0)
F96=ROUND(EXP(Sheet1!C96),0)
F97=ROUND(EXP(Sheet1!C97),0)
F98=ROUND(EXP(Sheet1!C98),0)
F99=ROUND(EXP(Sheet1!C99),0)
G2=ROUND(EXP(Sheet1!M2),0)
G3=ROUND(EXP(Sheet1!M3),0)
G4=ROUND(EXP(Sheet1!M4),0)
G5=ROUND(EXP(Sheet1!M5),0)
G6=ROUND(EXP(Sheet1!M6),0)
G7=ROUND(EXP(Sheet1!M7),0)
G8=ROUND(EXP(Sheet1!M8),0)
G9=ROUND(EXP(Sheet1!M9),0)
G10=ROUND(EXP(Sheet1!M10),0)
G11=ROUND(EXP(Sheet1!M11),0)
G12=ROUND(EXP(Sheet1!M12),0)
G13=ROUND(EXP(Sheet1!M13),0)
G14=ROUND(EXP(Sheet1!M14),0)
G15=ROUND(EXP(Sheet1!M15),0)
G16=ROUND(EXP(Sheet1!M16),0)
G17=ROUND(EXP(Sheet1!M17),0)
G18=ROUND(EXP(Sheet1!M18),0)
G19=ROUND(EXP(Sheet1!M19),0)
G20=ROUND(EXP(Sheet1!M20),0)
G21=ROUND(EXP(Sheet1!M21),0)
G22=ROUND(EXP(Sheet1!M22),0)
G23=ROUND(EXP(Sheet1!M23),0)
G24=ROUND(EXP(Sheet1!M24),0)
G25=ROUND(EXP(Sheet1!M25),0)
G26=ROUND(EXP(Sheet1!M26),0)
G27=ROUND(EXP(Sheet1!M27),0)
G28=ROUND(EXP(Sheet1!M28),0)
G29=ROUND(EXP(Sheet1!M29),0)
G30=ROUND(EXP(Sheet1!M30),0)
G31=ROUND(EXP(Sheet1!M31),0)
G32=ROUND(EXP(Sheet1!M32),0)
G33=ROUND(EXP(Sheet1!M33),0)
G34=ROUND(EXP(Sheet1!M34),0)
G35=ROUND(EXP(Sheet1!M35),0)
G36=ROUND(EXP(Sheet1!M36),0)
G37=ROUND(EXP(Sheet1!M37),0)
G38=ROUND(EXP(Sheet1!M38),0)
G39=ROUND(EXP(Sheet1!M39),0)
G40=ROUND(EXP(Sheet1!M40),0)
G41=ROUND(EXP(Sheet1!M41),0)
G42=ROUND(EXP(Sheet1!M42),0)
G43=ROUND(EXP(Sheet1!M43),0)
G44=ROUND(EXP(Sheet1!M44),0)
G45=ROUND(EXP(Sheet1!M45),0)
G46=ROUND(EXP(Sheet1!M46),0)
G47=ROUND(EXP(Sheet1!M47),0)
G48=ROUND(EXP(Sheet1!M48),0)
G49=ROUND(EXP(Sheet1!M49),0)
G50=ROUND(EXP(Sheet1!M50),0)
G51=ROUND(EXP(Sheet1!M51),0)
G52=ROUND(EXP(Sheet1!M52),0)
G53=ROUND(EXP(Sheet1!M53),0)
G54=ROUND(EXP(Sheet1!M54),0)
G55=ROUND(EXP(Sheet1!M55),0)
G56=ROUND(EXP(Sheet1!M56),0)
G57=ROUND(EXP(Sheet1!M57),0)
G58=ROUND(EXP(Sheet1!M58),0)
G59=ROUND(EXP(Sheet1!M59),0)
G60=ROUND(EXP(Sheet1!M60),0)
G61=ROUND(EXP(Sheet1!M61),0)
G62=ROUND(EXP(Sheet1!M62),0)
G63=ROUND(EXP(Sheet1!M63),0)
G64=ROUND(EXP(Sheet1!M64),0)
G65=ROUND(EXP(Sheet1!M65),0)
G66=ROUND(EXP(Sheet1!M66),0)
G67=ROUND(EXP(Sheet1!M67),0)
G68=ROUND(EXP(Sheet1!M68),0)
G69=ROUND(EXP(Sheet1!M69),0)
G70=ROUND(EXP(Sheet1!M70),0)
G71=ROUND(EXP(Sheet1!M71),0)
G72=ROUND(EXP(Sheet1!M72),0)
G73=ROUND(EXP(Sheet1!M73),0)
G74=ROUND(EXP(Sheet1!M74),0)
G75=ROUND(EXP(Sheet1!M75),0)
G76=ROUND(EXP(Sheet1!M76),0)
G77=ROUND(EXP(Sheet1!M77),0)
G78=ROUND(EXP(Sheet1!M78),0)
G79=ROUND(EXP(Sheet1!M79),0)
G80=ROUND(EXP(Sheet1!M80),0)
G81=ROUND(EXP(Sheet1!M81),0)
G82=ROUND(EXP(Sheet1!M82),0)
G83=ROUND(EXP(Sheet1!M83),0)
G84=ROUND(EXP(Sheet1!M84),0)
G85=ROUND(EXP(Sheet1!M85),0)
G86=ROUND(EXP(Sheet1!M86),0)
G87=ROUND(EXP(Sheet1!M87),0)
G88=ROUND(EXP(Sheet1!M88),0)
G89=ROUND(EXP(Sheet1!M89),0)
G90=ROUND(EXP(Sheet1!M90),0)
G91=ROUND(EXP(Sheet1!M91),0)
G92=ROUND(EXP(Sheet1!M92),0)
G93=ROUND(EXP(Sheet1!M93),0)
G94=ROUND(EXP(Sheet1!M94),0)
G95=ROUND(EXP(Sheet1!M95),0)
G96=ROUND(EXP(Sheet1!M96),0)
G97=ROUND(EXP(Sheet1!M97),0)
G98=ROUND(EXP(Sheet1!M98),0)
G99=ROUND(EXP(Sheet1!M99),0)
I2=ROUND(E2-B2,0)
I3=ROUND(E3-B3,0)
I4=ROUND(E4-B4,0)
I5=ROUND(E5-B5,0)
I6=ROUND(E6-B6,0)
I7=ROUND(E7-B7,0)
I8=ROUND(E8-B8,0)
I9=ROUND(E9-B9,0)
I10=ROUND(E10-B10,0)
I11=ROUND(E11-B11,0)
I12=ROUND(E12-B12,0)
I13=ROUND(E13-B13,0)
I14=ROUND(E14-B14,0)
I15=ROUND(E15-B15,0)
I16=ROUND(E16-B16,0)
I17=ROUND(E17-B17,0)
I18=ROUND(E18-B18,0)
I19=ROUND(E19-B19,0)
I20=ROUND(E20-B20,0)
I21=ROUND(E21-B21,0)
I22=ROUND(E22-B22,0)
I23=ROUND(E23-B23,0)
I24=ROUND(E24-B24,0)
I25=ROUND(E25-B25,0)
I26=ROUND(E26-B26,0)
I27=ROUND(E27-B27,0)
I28=ROUND(E28-B28,0)
I29=ROUND(E29-B29,0)
I30=ROUND(E30-B30,0)
I31=ROUND(E31-B31,0)
I32=ROUND(E32-B32,0)
I33=ROUND(E33-B33,0)
I34=ROUND(E34-B34,0)
I35=ROUND(E35-B35,0)
I36=ROUND(E36-B36,0)
I37=ROUND(E37-B37,0)
I38=ROUND(E38-B38,0)
I39=ROUND(E39-B39,0)
I40=ROUND(E40-B40,0)
I41=ROUND(E41-B41,0)
I42=ROUND(E42-B42,0)
I43=ROUND(E43-B43,0)
I44=ROUND(E44-B44,0)
I45=ROUND(E45-B45,0)
I46=ROUND(E46-B46,0)
I47=ROUND(E47-B47,0)
I48=ROUND(E48-B48,0)
I49=ROUND(E49-B49,0)
I50=ROUND(E50-B50,0)
I51=ROUND(E51-B51,0)
I52=ROUND(E52-B52,0)
I53=ROUND(E53-B53,0)
I54=ROUND(E54-B54,0)
I55=ROUND(E55-B55,0)
I56=ROUND(E56-B56,0)
I57=ROUND(E57-B57,0)
I58=ROUND(E58-B58,0)
I59=ROUND(E59-B59,0)
I60=ROUND(E60-B60,0)
I61=ROUND(E61-B61,0)
I62=ROUND(E62-B62,0)
I63=ROUND(E63-B63,0)
I64=ROUND(E64-B64,0)
I65=ROUND(E65-B65,0)
I66=ROUND(E66-B66,0)
I67=ROUND(E67-B67,0)
I68=ROUND(E68-B68,0)
I69=ROUND(E69-B69,0)
I70=ROUND(E70-B70,0)
I71=ROUND(E71-B71,0)
I72=ROUND(E72-B72,0)
I73=ROUND(E73-B73,0)
I74=ROUND(E74-B74,0)
I75=ROUND(E75-B75,0)
I76=ROUND(E76-B76,0)
I77=ROUND(E77-B77,0)
I78=ROUND(E78-B78,0)
I79=ROUND(E79-B79,0)
I80=ROUND(E80-B80,0)
I81=ROUND(E81-B81,0)
I82=ROUND(E82-B82,0)
I83=ROUND(E83-B83,0)
I84=ROUND(E84-B84,0)
I85=ROUND(E85-B85,0)
I86=ROUND(E86-B86,0)
I87=ROUND(E87-B87,0)
I88=ROUND(E88-B88,0)
I89=ROUND(E89-B89,0)
I90=ROUND(E90-B90,0)
I91=ROUND(E91-B91,0)
I92=ROUND(E92-B92,0)
I93=ROUND(E93-B93,0)
I94=ROUND(E94-B94,0)
I95=ROUND(E95-B95,0)
I96=ROUND(E96-B96,0)
I97=ROUND(E97-B97,0)
I98=ROUND(E98-B98,0)
I99=ROUND(E99-B99,0)
J2=ROUND(B2-F2,0)
J3=ROUND(B3-F3,0)
J4=ROUND(B4-F4,0)
J5=ROUND(B5-F5,0)
J6=ROUND(B6-F6,0)
J7=ROUND(B7-F7,0)
J8=ROUND(B8-F8,0)
J9=ROUND(B9-F9,0)
J10=ROUND(B10-F10,0)
J11=ROUND(B11-F11,0)
J12=ROUND(B12-F12,0)
J13=ROUND(B13-F13,0)
J14=ROUND(B14-F14,0)
J15=ROUND(B15-F15,0)
J16=ROUND(B16-F16,0)
J17=ROUND(B17-F17,0)
J18=ROUND(B18-F18,0)
J19=ROUND(B19-F19,0)
J20=ROUND(B20-F20,0)
J21=ROUND(B21-F21,0)
J22=ROUND(B22-F22,0)
J23=ROUND(B23-F23,0)
J24=ROUND(B24-F24,0)
J25=ROUND(B25-F25,0)
J26=ROUND(B26-F26,0)
J27=ROUND(B27-F27,0)
J28=ROUND(B28-F28,0)
J29=ROUND(B29-F29,0)
J30=ROUND(B30-F30,0)
J31=ROUND(B31-F31,0)
J32=ROUND(B32-F32,0)
J33=ROUND(B33-F33,0)
J34=ROUND(B34-F34,0)
J35=ROUND(B35-F35,0)
J36=ROUND(B36-F36,0)
J37=ROUND(B37-F37,0)
J38=ROUND(B38-F38,0)
J39=ROUND(B39-F39,0)
J40=ROUND(B40-F40,0)
J41=ROUND(B41-F41,0)
J42=ROUND(B42-F42,0)
J43=ROUND(B43-F43,0)
J44=ROUND(B44-F44,0)
J45=ROUND(B45-F45,0)
J46=ROUND(B46-F46,0)
J47=ROUND(B47-F47,0)
J48=ROUND(B48-F48,0)
J49=ROUND(B49-F49,0)
J50=ROUND(B50-F50,0)
J51=ROUND(B51-F51,0)
J52=ROUND(B52-F52,0)
J53=ROUND(B53-F53,0)
J54=ROUND(B54-F54,0)
J55=ROUND(B55-F55,0)
J56=ROUND(B56-F56,0)
J57=ROUND(B57-F57,0)
J58=ROUND(B58-F58,0)
J59=ROUND(B59-F59,0)
J60=ROUND(B60-F60,0)
J61=ROUND(B61-F61,0)
J62=ROUND(B62-F62,0)
J63=ROUND(B63-F63,0)
J64=ROUND(B64-F64,0)
J65=ROUND(B65-F65,0)
J66=ROUND(B66-F66,0)
J67=ROUND(B67-F67,0)
J68=ROUND(B68-F68,0)
J69=ROUND(B69-F69,0)
J70=ROUND(B70-F70,0)
J71=ROUND(B71-F71,0)
J72=ROUND(B72-F72,0)
J73=ROUND(B73-F73,0)
J74=ROUND(B74-F74,0)
J75=ROUND(B75-F75,0)
J76=ROUND(B76-F76,0)
J77=ROUND(B77-F77,0)
J78=ROUND(B78-F78,0)
J79=ROUND(B79-F79,0)
J80=ROUND(B80-F80,0)
J81=ROUND(B81-F81,0)
J82=ROUND(B82-F82,0)
J83=ROUND(B83-F83,0)
J84=ROUND(B84-F84,0)
J85=ROUND(B85-F85,0)
J86=ROUND(B86-F86,0)
J87=ROUND(B87-F87,0)
J88=ROUND(B88-F88,0)
J89=ROUND(B89-F89,0)
J90=ROUND(B90-F90,0)
J91=ROUND(B91-F91,0)
J92=ROUND(B92-F92,0)
J93=ROUND(B93-F93,0)
J94=ROUND(B94-F94,0)
J95=ROUND(B95-F95,0)
J96=ROUND(B96-F96,0)
J97=ROUND(B97-F97,0)
J98=ROUND(B98-F98,0)
J99=ROUND(B99-F99,0)
K2=ROUND(G2-B2,0)
K3=ROUND(G3-B3,0)
K4=ROUND(G4-B4,0)
K5=ROUND(G5-B5,0)
K6=ROUND(G6-B6,0)
K7=ROUND(G7-B7,0)
K8=ROUND(G8-B8,0)
K9=ROUND(G9-B9,0)
K10=ROUND(G10-B10,0)
K11=ROUND(G11-B11,0)
K12=ROUND(G12-B12,0)
K13=ROUND(G13-B13,0)
K14=ROUND(G14-B14,0)
K15=ROUND(G15-B15,0)
K16=ROUND(G16-B16,0)
K17=ROUND(G17-B17,0)
K18=ROUND(G18-B18,0)
K19=ROUND(G19-B19,0)
K20=ROUND(G20-B20,0)
K21=ROUND(G21-B21,0)
K22=ROUND(G22-B22,0)
K23=ROUND(G23-B23,0)
K24=ROUND(G24-B24,0)
K25=ROUND(G25-B25,0)
K26=ROUND(G26-B26,0)
K27=ROUND(G27-B27,0)
K28=ROUND(G28-B28,0)
K29=ROUND(G29-B29,0)
K30=ROUND(G30-B30,0)
K31=ROUND(G31-B31,0)
K32=ROUND(G32-B32,0)
K33=ROUND(G33-B33,0)
K34=ROUND(G34-B34,0)
K35=ROUND(G35-B35,0)
K36=ROUND(G36-B36,0)
K37=ROUND(G37-B37,0)
K38=ROUND(G38-B38,0)
K39=ROUND(G39-B39,0)
K40=ROUND(G40-B40,0)
K41=ROUND(G41-B41,0)
K42=ROUND(G42-B42,0)
K43=ROUND(G43-B43,0)
K44=ROUND(G44-B44,0)
K45=ROUND(G45-B45,0)
K46=ROUND(G46-B46,0)
K47=ROUND(G47-B47,0)
K48=ROUND(G48-B48,0)
K49=ROUND(G49-B49,0)
K50=ROUND(G50-B50,0)
K51=ROUND(G51-B51,0)
K52=ROUND(G52-B52,0)
K53=ROUND(G53-B53,0)
K54=ROUND(G54-B54,0)
K55=ROUND(G55-B55,0)
K56=ROUND(G56-B56,0)
K57=ROUND(G57-B57,0)
K58=ROUND(G58-B58,0)
K59=ROUND(G59-B59,0)
K60=ROUND(G60-B60,0)
K61=ROUND(G61-B61,0)
K62=ROUND(G62-B62,0)
K63=ROUND(G63-B63,0)
K64=ROUND(G64-B64,0)
K65=ROUND(G65-B65,0)
K66=ROUND(G66-B66,0)
K67=ROUND(G67-B67,0)
K68=ROUND(G68-B68,0)
K69=ROUND(G69-B69,0)
K70=ROUND(G70-B70,0)
K71=ROUND(G71-B71,0)
K72=ROUND(G72-B72,0)
K73=ROUND(G73-B73,0)
K74=ROUND(G74-B74,0)
K75=ROUND(G75-B75,0)
K76=ROUND(G76-B76,0)
K77=ROUND(G77-B77,0)
K78=ROUND(G78-B78,0)
K79=ROUND(G79-B79,0)
K80=ROUND(G80-B80,0)
K81=ROUND(G81-B81,0)
K82=ROUND(G82-B82,0)
K83=ROUND(G83-B83,0)
K84=ROUND(G84-B84,0)
K85=ROUND(G85-B85,0)
K86=ROUND(G86-B86,0)
K87=ROUND(G87-B87,0)
K88=ROUND(G88-B88,0)
K89=ROUND(G89-B89,0)
K90=ROUND(G90-B90,0)
K91=ROUND(G91-B91,0)
K92=ROUND(G92-B92,0)
K93=ROUND(G93-B93,0)
K94=ROUND(G94-B94,0)
K95=ROUND(G95-B95,0)
K96=ROUND(G96-B96,0)
K97=ROUND(G97-B97,0)
K98=ROUND(G98-B98,0)
K99=ROUND(G99-B99,0)


Macros:
Code:
Sub Minimize_Smoothing_Constant()
Dim i As Single, RowNumber As Integer
RowNumber = 12
With ActiveSheet
    For i = 0.1 To 1 Step 0.1
        .Cells(3, 5) = i
        .Cells(RowNumber, 5) = i
        .Cells(RowNumber, 6) = .Cells(6, 6)
        RowNumber = RowNumber + 1
    Next i
End With
End Sub

Code:
Option Explicit

Private Sub SpinButton1_Change()
SpinButton1.Max = 20
SpinButton1.Min = 12
Range("E3").Value = Range("E" & SpinButton1.Value).Value
Range("F6").Value = Range("E" & SpinButton1.Value).Offset(0, 1).Value
End Sub

Private Sub SpinButton2_Change()
SpinButton2.Max = 28
SpinButton2.Min = 4
Range("E6").Value = Range("H" & SpinButton2.Value).Value
End Sub

There are two spin buttons on sheet 1 that allow you to select the smoothing constant, and the confidence interval.
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
This may be easier to see the results of what I did:


Excel 2012
ABC
1WeekActualActual Forecast
21100
3288
4378
5478
6556
7612
8733
9811
1091010
111034
121166
131212
141333
15142121
16151113
171656
181756
19181011
20195051
21205763
22213441
23224953
2423277283
2524172209
2625170194
2726175197
2827520541
2928368
30295865
31306673
32314047
33325762
3433323329
3534200235
3635198223
3736204227
3837607631
3938473
40395865
41406673
42414047
43425762
4443323329
4544200234
4645198222
4746204227
4847607630
4948471
50492229
5150325328
5251495529
5352458513
5453517570
5554868927
5655728826
5756701787
5857759841
595820782165
605913249
6160227
6261179182
6362213231
6463122145
6564173188
666510161035
6766619726
6867654728
6968636710
706917921865
717012208
72712849
73725560
7473118124
75745466
7675133140
77765569
7877120127
79784558
8079462468
81801461
8281157163
8382135151
8483146161
8584131147
8685546561
8786725782
8887271351
8988729764
908920822160
919023248
92911035
93926568
9493111118
95943244
96957983
9796562570
989799157
99981733
Sheet3
 
Upvote 0
This is the formula for cell f6 on sheet 1:

=SQRT(SUMXMY2(OFFSET($B$2,0,0,COUNTA($B:$B),-1),OFFSET($C$2,0,0,COUNTA($C:$C),-1))/COUNT(OFFSET($B$2,0,0,COUNTA($B:$B),-1)))
 
Upvote 0
I certainly started off with an aggregate column to keep a running total of the data and have thought about breaking it out mathematically; however, this information needs to be fairly universal as I will not always be the one inputting. My gut was to develop a UDF to loop through each row of the table where when the SKU matches the SKU at the current row it would create an array of Y values and X's values and propose the new X value as the date at the current row. I can perform this very act through building the array through a conjoining statement such as ()*() with the multiple qualifiers, except it reduces the False values to "0". I worked at trying to develop the array through a function inside the worksheet, I just don't see that being possible. A loop with a Dim Long to build the necessary arrays to input into the Application.WorksheetFunction.Trend seems like a scenario that would be suitable for future use. What are you thoughts? This would avoid the non-linear setup of the data or at the least negate it.

I do thank you very much for the mathematical solution, and I have developed a version similar, I just was trying to avoid the multitude of creating various ancillary columns for statistical analysis purposes.
 
Last edited:
Upvote 0
I'm not sure how to go about what you are wanting to do if not something like this. Maybe someone else on here will be able to do something with arrays to accomplish what you want. Good luck.

Mike
 
Upvote 0
I do greatly appreciate the solution Mike. It definitely an option I am going to utilize should I not be able to complete a loop function to use within the WorksheetFunction.Trend.
 
Upvote 0
This is an example of what I am wanting to do. The problem is that the WorksheetFunction.Trend isn't recognizing the ActualList and the DateList as valid arguments for the known Y's and X's.

Code:
Dim tbl As ListObject
Dim curDate As Date
Dim ActualList As Long
Dim Datelist As Long

Set tbl = ActiveSheet.ListObjects("RawSalesDataTbl")
curDate = Cells(ActiveCell.Row, Range("RawSalesDataTbl[Week '#]").Column).Value
curSKU = Cells(ActiveCell.Row, Range("RawSalesDataTbl[SKU]").Column).Value
curSource = Cells(ActiveCell.Row, Range("RawSalesDataTbl[Source]").Column).Value

    MsgBox curDate & " " & curSKU
    
For i = 2 To tbl.Range.Rows.Count

    If Cells(i, Range("RawSalesDataTbl[Week '#]").Column).Value <= curDate Then
        
        If Cells(i, Range("RawSalesDataTbl[SKU]").Column).Value = curSKU Then
        
            If Cells(i, Range("RawSalesDataTbl[Source]").Column).Value = curSource Then

                           
                ActualList = Cells(i, Range("RawSalesDataTbl[Actual]").Column).Value
                Datelist = Cells(i, Range("RawSalesDataTbl[Week '#]").Column).Value
                
            
            End If
            
        End If
        
    End If
    
Next i

MsgBox Application.WorksheetFunction.Trend(ActualList, Datelist, curDate)

The goal will be the set a UDF to this macro to input into the trend column of the table.
 
Upvote 0
Just looking back over your macro. Have a couple of questions, and one suggestion, just to see what happens.

Try this code:
Code:
Sub VBA_Trend_Forecast()
Dim tbl As ListObject
Dim curDate As Date
Dim ActualList As Long
Dim Datelist As Long

Set tbl = ActiveSheet.ListObjects("RawSalesDataTbl")
curDate = Cells(ActiveCell.Row, Range("RawSalesDataTbl[Week '#]").Column).Value
curSKU = Cells(ActiveCell.Row, Range("RawSalesDataTbl[SKU]").Column).Value
curSource = Cells(ActiveCell.Row, Range("RawSalesDataTbl[Source]").Column).Value

    MsgBox curDate & " " & curSKU
    
For i = 2 To tbl.Range.Rows.Count

    If Cells(i, Range("RawSalesDataTbl[Week '#]").Column).Value <= curDate Then
        
        If Cells(i, Range("RawSalesDataTbl[SKU]").Column).Value = curSKU Then
        
            If Cells(i, Range("RawSalesDataTbl[Source]").Column).Value = curSource Then

                           
                ActualList = Cells(i, Range("RawSalesDataTbl[Actual]").Column).Value
                Datelist = Cells(i, Range("RawSalesDataTbl[Week '#]").Column).Value
                MsgBox Application.WorksheetFunction.Trend(ActualList, Datelist, curDate)
            
            End If
            
        End If
        
    End If
    
Next i

End Sub

Are you trying to use the trend function in vba instead of the formula in the worksheet? It seems like to me your macro is not giving you the trend in the message box because it is still looping through the individual cells. I think your acuallist and datelist need to be adjusted for the entire column each, if this makes sense.

Just a thought.

Mike
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top