Formula issues to find variations when zero is one reference value

vladimiratanasiu

Active Member
Joined
Dec 17, 2010
Messages
346
Office Version
  1. 2021
  2. 2019
Platform
  1. Windows
Hello!

I have a multiannual table, with monthly consumption (column Q) and cost of the electric power (column R). In columns W and X are calculated variations (+/-) of these indicators for that specific month, vs. the same period of the previous year. In addition, the columns W and X includes at the end of each year the monthly average of consumption and cost (W34:X34; W51:X51 etc.), counted as a fix value (sum of all monthly values/12 months). Since 2022, it’s calculated also as a progressive value (sum of all available monthly values at one moment / number of those months – W68:X68; W87:X87 etc.). For monthly variations I used a formula that works satisfactory, to divide similar periods from two consecutive years and find the variations. However, when it meets a in one month a positive value and no value in the similar month from previous year (e.g. Q79 vs. Q60; Q84 vs. Q65 etc.), it results the zero value (see W79, W84) but real variation is different (see Y79 - + 18800%; Y84 - +4100%). My question is what formula could be used in order to calculate and show these variances correctly, taking into account also the case when is met the zero value? Thank you!

Book1.xlsx
ABQRWXYZ
1
22019
3PeriodKwhCostKwhCost
4Jan-1978.29129.00
5Feb-1970.720.00
6Mar-1971.48125.40
7Apr-1964.4220.40
8May-1966.570.00
9Jun-1964.4277.97
10Jul-1966.570.00
11Aug-1966.5795.14
12Sep-1966.290.00
13Oct-1969.790.00
14Nov-1967.5473.30
15Dec-1969.7961.67
16Total annual822.45582.88
17 Average power consumption / month68.5448.57
202020
21Jan-2069.790.00-10.86%-19.68%
22Feb-2065.29103.61-7.68%
23Mar-2056.510.00-20.94%-32.77%
24Apr-2054.2798.02-15.76%
25May-2056.080.00-15.76%-22.39%
26Jun-2054.2760.51-15.76%
27Jul-2056.080.00-15.76%-24.07%
28Aug-2056.0872.24-15.76%
29Sep-2055.070.00-16.93%0.00%
30Oct-2057.8471.41-17.12%
31Nov-2055.970.00-17.13%-40.94%
32Dec-2013.0679.71-81.29%
33Total annual650.31485.50
34 Average power consumption / month54.1940.46-20.93%-16.71%
372021
38Jan-2167.820.00-2.82%0.87%
39Feb-2161.25104.51-6.19%
40Mar-2159.190.004.74%2.63%
41Apr-2148.36100.60-10.89%
42May-2149.970.00-10.90%31.76%
43Jun-2148.3679.73-10.89%
44Jul-2149.970.00-10.90%10.87%
45Aug-2116.1280.09-71.26%
46Sep-2167.000.0021.66%-10.70%
47Oct-2111.0063.77-80.98%
48Nov-2144.0035.97-21.39%-54.87%
49Dec-210.000.00-100.00%
50Total annual523.04464.67
51 Average power consumption / month43.5938.72-19.57%-4.29%
542022
55Jan-2254.0036.57-20.38%-22.24%
56Feb-2266.0044.707.76%
57Mar-2278.0053.0431.78%-1.30%
58Apr-2268.0046.2540.61%
59May-22-10.00-7.12-120.01%-108.93%
60Jun-220.000.00-100.00%
61Jul-220.000.00-100.00%-58.40%
62Aug-2249.0033.32203.97%
63Sep-2227.0018.13-59.70%-17.28%
64Oct-2251.0034.62363.64%
65Nov-220.000.00-100.00%-100.00%
66Dec-220.000.000.00%
67Total annual383.00259.51
68Monthly averageProgressive31.9221.63-26.77%-44.15%
69Fix31.9221.63-26.77%-44.15%
732023
74Jan-230.000.00-100.00%-100.00%
75Feb-230.000.00-100.00%-100.00%
76Mar-23106.0064.9835.90%22.51%
77Apr-2396.0064.6741.18%39.83%
78May-2346.0031.72-560.00%-545.51%
79Jun-23188.00143.530.00%0.00%18800.00%14353.00%
80Jul-230.000.000.00%0.00%
81Aug-23139.0094.51183.67%183.64%
82Sep-2352.0035.3792.59%95.09%
83Oct-230.000.00-100.00%-100.00%
84Nov-2341.0027.900.00%0.00%4100.00%2790.00%
85Dec-230.000.000.00%0.00%
86Total annual668.00462.68
87Monthly averageProgressive55.6738.5674.41%78.29%
88Fix55.6738.5674.41%78.29%
922024
93Jan-2462.0042.170.00%0.00%6200.00%4217.00%
94Feb-240.00%0.00%
95Mar-24-100.00%-100.00%
96Apr-24-100.00%-100.00%
97May-24-100.00%-100.00%
98Jun-24-100.00%-100.00%
99Jul-240.00%0.00%
100Aug-24-100.00%-100.00%
101Sep-24-100.00%-100.00%
102Oct-240.00%0.00%
103Nov-24-100.00%-100.00%
104Dec-240.00%0.00%
105Total annual62.0042.17
106Monthly averageProgressive62.0042.17#DIV/0!#DIV/0!
107Fix5.173.51-90.72%-90.89%
Sheet2
Cell Formulas
RangeFormula
Q16:R16,Q105:R105,Q86:R86,Q67:R67,Q50:R50,Q33:R33Q16=SUM(Q4:Q15)
Q17:R17,Q51:R51,Q34:R34Q17=Q16/COUNTA(Q4:Q15)
W21:W32,W55:W66,W51:X51,W38:W49,W34:X34W21=IFERROR(-(1-Q21/Q4),0)
X21,X23,X25,X27,X29,X31,X55,X57,X59,X61,X63,X65,X38,X40,X42,X44,X46,X48X21=IFERROR(-(1-(R21+R22)/(R4+R5)),0)
Q68:R68Q68=AVERAGE(--Q55:INDEX(Q1:Q66,LOOKUP(99^99,Q1:Q66,ROW(Q1:Q66))))
Q69:R69,Q107:R107,Q88:R88Q69=Q67/12
W68:X68W68=-(1-(SUM(Q55:Q66)/SUM(Q38:OFFSET(Q38,SUMPRODUCT(MATCH(1,0/(Q55:Q66<>"")))-1,0))))
W69:X69W69=IFERROR(-(1-Q69/Q51),0)
W74:W78,W107:X107,W94:W104,W88:X88,W85,W80:W83W74=IFERROR(-(1-Q74/Q55),0)
X74:X78,X94:X104,X85,X80:X83X74=IFERROR(-(1-(R74/R55)),0)
R79R79=109.53+34
Q87,Q106Q87=AVERAGE(--Q74:INDEX($Q$1:Q85,LOOKUP(99^99,$Q$1:Q85,ROW($Q$1:Q85))))
R87R87=AVERAGE(--R74:INDEX(R1:R85,LOOKUP(99^99,R1:R85,ROW(R1:R85))))
W87:X87,W106:X106W87=-(1-(SUM(Q74:Q85)/SUM(Q55:OFFSET(Q55,SUMPRODUCT(MATCH(1,0/(Q74:Q85<>"")))-1,0))))
R106R106=AVERAGE(--R93:INDEX(R1:R104,LOOKUP(99^99,R1:R104,ROW(R1:R104))))
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,215,076
Messages
6,122,988
Members
449,093
Latest member
Mr Hughes

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