vladimiratanasiu
Active Member
- Joined
- Dec 17, 2010
- Messages
- 348
- Office Version
- 365
- 2021
- Platform
- Windows
Hello!
I posted some weeks ago a message regarding a dynamic formula of monthly costs, getting in the answer Formula to calculate dynamic average of monthly costs a good solution adapted to the conditions at that time. Shortely, it calculates dinamically (see value from D88) the average of all monthly values , excepting the annually totals and moving down in line with the each new number inserted. If I add the new values manually, the formula works according to my needs. The problem is when my monthly cells are linked by formulas with data from another table (see F51:F88) and the values are imported automatically from it. In our example, the cells from C85:C88 are linked with those from F85:F88, but the last ones have no content yet. In these conditions, the cells C85:C88 show value 0 / blank space, and the average (D88) is calculated and moves automatically in line with the last cell (C88). My question is how could be adjusted the given formula, so that the right result (e.g. value from E84) can be shown progressively in line only with the last cell (e.g. C84) related with real data from the source table , and can avoid in calculation the next ones (C85:C88) that have no equivalent numerical in the source range.
Thank you!
I posted some weeks ago a message regarding a dynamic formula of monthly costs, getting in the answer Formula to calculate dynamic average of monthly costs a good solution adapted to the conditions at that time. Shortely, it calculates dinamically (see value from D88) the average of all monthly values , excepting the annually totals and moving down in line with the each new number inserted. If I add the new values manually, the formula works according to my needs. The problem is when my monthly cells are linked by formulas with data from another table (see F51:F88) and the values are imported automatically from it. In our example, the cells from C85:C88 are linked with those from F85:F88, but the last ones have no content yet. In these conditions, the cells C85:C88 show value 0 / blank space, and the average (D88) is calculated and moves automatically in line with the last cell (C88). My question is how could be adjusted the given formula, so that the right result (e.g. value from E84) can be shown progressively in line only with the last cell (e.g. C84) related with real data from the source table , and can avoid in calculation the next ones (C85:C88) that have no equivalent numerical in the source range.
Thank you!
Book1.xlsx | ||||||||
---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | |||
1 | Year | Month | Costs | |||||
2 | 2017 | Apr-17 | 34.83 | 34.83 | ||||
3 | May-17 | 72 | 72 | |||||
4 | Jun-17 | 74.77 | 74.77 | |||||
5 | Jul-17 | 77.74 | 77.74 | |||||
6 | Aug-17 | 76.5 | 76.5 | |||||
7 | Sep-17 | 67.74 | 67.74 | |||||
8 | Oct-17 | 130.11 | 130.11 | |||||
9 | Nov-17 | 183.44 | 183.44 | |||||
10 | Dec-17 | 189.56 | 189.56 | |||||
11 | Total | 906.69 | ||||||
12 | 2018 | Jan-18 | 189.56 | 189.56 | ||||
13 | Feb-18 | 169.62 | 169.62 | |||||
14 | Mar-18 | 177.41 | 177.41 | |||||
15 | Apr-18 | 128.08 | 128.08 | |||||
16 | May-18 | 132.35 | 132.35 | |||||
17 | Jun-18 | 128.08 | 128.08 | |||||
18 | Jul-18 | 132.35 | 132.35 | |||||
19 | Aug-18 | 132.35 | 132.35 | |||||
20 | Sep-18 | 113.2 | 113.2 | |||||
21 | Oct-18 | 78.29 | 78.29 | |||||
22 | Nov-18 | 75.77 | 75.77 | |||||
23 | Dec-18 | 78.29 | 78.29 | |||||
24 | Total | 1535.35 | ||||||
25 | 2019 | Jan-19 | 78.29 | 78.29 | ||||
26 | Feb-19 | 70.72 | 70.72 | |||||
27 | Mar-19 | 71.48 | 71.48 | |||||
28 | Apr-19 | 64.42 | 64.42 | |||||
29 | May-19 | 66.57 | 66.57 | |||||
30 | Jun-19 | 64.42 | 64.42 | |||||
31 | Jul-19 | 66.57 | 66.57 | |||||
32 | Aug-19 | 66.57 | 66.57 | |||||
33 | Sep-19 | 66.29 | 66.29 | |||||
34 | Oct-19 | 69.79 | 69.79 | |||||
35 | Nov-19 | 67.54 | 67.54 | |||||
36 | Dec-19 | 69.79 | 69.79 | |||||
37 | Total | 822.45 | ||||||
38 | 2020 | Jan-20 | 69.79 | 69.79 | ||||
39 | Feb-20 | 65.29 | 65.29 | |||||
40 | Mar-20 | 56.51 | 56.51 | |||||
41 | Apr-20 | 54.27 | 54.27 | |||||
42 | May-20 | 56.08 | 56.08 | |||||
43 | Jun-20 | 54.27 | 54.27 | |||||
44 | Jul-20 | 56.08 | 56.08 | |||||
45 | Aug-20 | 56.08 | 56.08 | |||||
46 | Sep-20 | 55.07 | 55.07 | |||||
47 | Oct-20 | 57.84 | 57.84 | |||||
48 | Nov-20 | 55.97 | 55.97 | |||||
49 | Dec-20 | 13.06 | 13.06 | |||||
50 | Total | 650.31 | ||||||
51 | 2021 | 1/1/2021 | 67.82 | 67.82 | ||||
52 | 2/1/2021 | 61.25 | 61.25 | |||||
53 | 3/1/2021 | 59.19 | 59.19 | |||||
54 | 4/1/2021 | 48.36 | 48.36 | |||||
55 | 5/1/2021 | 49.97 | 49.97 | |||||
56 | 6/1/2021 | 48.36 | 48.36 | |||||
57 | 7/1/2021 | 49.97 | 49.97 | |||||
58 | 8/1/2021 | 16.12 | 16.12 | |||||
59 | 9/1/2021 | 67 | 67 | |||||
60 | 10/1/2021 | 11 | 11 | |||||
61 | 11/1/2021 | 44 | 44 | |||||
62 | 12/1/2021 | 0 | 0 | |||||
63 | Total | 523.04 | ||||||
64 | 2022 | 1/1/2022 | 54 | 54 | ||||
65 | 2/1/2022 | 66 | 66 | |||||
66 | 3/1/2022 | 78 | 78 | |||||
67 | 4/1/2022 | 68 | 68 | |||||
68 | 5/1/2022 | -10 | -10 | |||||
69 | 6/1/2022 | 0 | 0 | |||||
70 | 7/1/2022 | 0 | 0 | |||||
71 | 8/1/2022 | 49 | 49 | |||||
72 | 9/1/2022 | 27 | 27 | |||||
73 | 10/1/2022 | 51 | 51 | |||||
74 | 11/1/2022 | 0 | 0 | |||||
75 | 12/1/2022 | 0 | 0 | |||||
76 | Total | 383 | ||||||
77 | 2023 | 1/1/2023 | 0 | 0 | ||||
78 | 2/1/2023 | 0 | 0 | |||||
79 | 3/1/2023 | 106 | 106 | |||||
80 | 4/1/2023 | 96 | 96 | |||||
81 | 5/1/2023 | 46 | 46 | |||||
82 | 6/1/2023 | 188 | 188 | |||||
83 | 7/1/2023 | 0 | 0 | |||||
84 | 8/1/2023 | 139 | 70.07584 | 139 | ||||
85 | 9/1/2023 | 0 | ||||||
86 | 10/1/2023 | 0 | ||||||
87 | 11/1/2023 | 0 | ||||||
88 | 12/1/2023 | 0 | 66.61531 | |||||
89 | Total | 575 | ||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
D2:D88 | D2 | =LET(a,COUNTA(C:C)-2,bb,SEQUENCE(a),c,AVERAGEIFS(C:C,B:B,">1"),IF(bb=a,c,"")) |
C2:C10,C12:C23,C25:C36,C38:C49,C51:C62,C64:C75,C77:C88 | C2 | =F2 |
C11 | C11 | =SUM(C2:C10) |
C24,C37,C50,C63,C76,C89 | C24 | =SUM(C12:C23) |
Dynamic array formulas. |
Last edited: