Average formula issue

Status
Not open for further replies.

vladimiratanasiu

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

I posted this message two weeks ago, but didn't get yet a proper solution. That is why, I write it again, hoping this time in an answer.
I have a table that shows the electric power data (period, consumption etc.) of a client. At the end of each year, it is calculated the monthly average of consumption and costs. Since 2022, giving the variation of months with / without consumption, it is included also a progressive average, calculated as mean value of the whole period between the first and the last month with non-zero energy (accounting also the zero consumption months from that range, when dividing) . In our example (cell Q68 - 38,3 kW), progressive average is given by the period January 2022 – October 2022, resulting a total of 383 kW/10 months. The issue appeared when I added the year 2023 and tried to adjust in the cells Q87 and R87 formulas from cells Q68 and R68, considering the new references (Q74 and R74). I applied a solution given before, but it works properly until 2022 only. In 2023, even if I didn't add yet new values, the cells Q87 and R87 show non-zero results (5,32; 3,6). Which is the right solution in this formula to result 0 in the cells Q87 and R87, when there is not added yet new value in them, and how should I adjust it when add a new similar table in the future (2024, 2025 etc.)?
Thank you!

Book5.xlsx
PQR
1Energy consumption
2
3PeriodKwhValue (including VAT)
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
17Average power consumption /month68.5448.57
18
19
20
21Jan-2069.790.00
22Feb-2065.29103.61
23Mar-2056.510.00
24Apr-2054.2798.02
25May-2056.080.00
26Jun-2054.2760.51
27Jul-2056.080.00
28Aug-2056.0872.24
29Sep-2055.070.00
30Oct-2057.8471.41
31Nov-2055.970.00
32Dec-2013.0679.71
33Total annual650.31485.50
34Average power consumption /month54.1940.46
35
36
37
38Jan-2167.820.00
39Feb-2161.25104.51
40Mar-2159.190.00
41Apr-2148.36100.60
42May-2149.970.00
43Jun-2148.3679.73
44Jul-2149.970.00
45Aug-2116.1280.09
46Sep-2167.000.00
47Oct-2111.0063.77
48Nov-2144.0035.97
49Dec-210.000.00
50Total annual523.04464.67
51Average power consumption /month43.5938.72
52
53
54
55Jan-2254.0036.57
56Feb-2266.0044.70
57Mar-2278.0053.04
58Apr-2268.0046.25
59May-22-10.00-7.12
60Jun-22
61Jul-22
62Aug-2249.0033.32
63Sep-2227.0018.13
64Oct-2251.0034.62
65Nov-22
66Dec-22
67Total annual383.00259.51
68Average power consumption /month38.3025.95
6931.9221.63
70
71
72
73
74Jan-23
75Feb-23
76Mar-23
77Apr-23
78May-23
79Jun-23
80Jul-23
81Aug-23
82Sep-23
83Oct-23
84Nov-23
85Dec-23
86Total annual0.000.00
87Average power consumption /month5.323.60
880.000.00
Sheet1
Cell Formulas
RangeFormula
Q16:R16,Q86:R86,Q67:R67,Q50:R50,Q33:R33Q16=SUM(Q4:Q15)
Q17:R17,Q51:R51,Q34:R34Q17=Q16/COUNTA(Q4:Q15)
Q68:R68Q68=AVERAGE(--Q55:INDEX(Q1:Q66,LOOKUP(99^99,Q1:Q66,ROW(Q1:Q66))))
Q69:R69,Q88:R88Q69=Q67/12
Q87Q87=AVERAGE(--Q74:INDEX($Q$1:Q85,LOOKUP(99^99,$Q$1:Q85,ROW($Q$1:Q85))))
R87R87=AVERAGE(--R74:INDEX($R$1:R85,LOOKUP(99^99,$R$1:R85,ROW($R$1:R85))))
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
are you asking for the months with zero to be excluded in your average calculations?
 
Upvote 0
Duplicate to: Adjust average formula properly when the table is extended

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread. If you do not receive a response, you can "bump" it by replying to it yourself, though we advise you to wait 24 hours before doing so, and not to bump a thread more than once a day.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,990
Messages
6,122,626
Members
449,093
Latest member
catterz66

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