Average from a table

nikolacm

New Member
Joined
Mar 31, 2021
Messages
31
Office Version
  1. 365
Platform
  1. Windows
I have a table which indicates indexation rates for each month and per year. Each column presents the year ending whereas each row indicates the monthly value per annum. In this case I would like to calculate the average rate of values indicated 12 months preceding June 2023. Manually I would use the formula AVERAGE by taking into account 5 months from column Dec-23 (January to June) and 6 months from column Dec-22 (July to December). How may I automate it ?

Thank you in advance,

Year Ending
Dec-22​
Dec-23​
Dec-24​
Dec-25​
Dec-26​
Dec-27​
Dec-28​
Dec-29​
Dec-30​
Dec-31​
Dec-32​
Dec-33​
Jan​
10,85%​
5,07%​
1,95%​
2,14%​
2,71%​
2,94%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
Feb​
10,85%​
5,07%​
1,95%​
2,14%​
2,71%​
2,94%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
Mar​
10,85%​
5,07%​
1,95%​
2,14%​
2,71%​
2,94%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
Apr​
10,85%​
5,07%​
1,95%​
2,14%​
2,71%​
2,94%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
May​
10,85%​
5,07%​
1,95%​
2,14%​
2,71%​
2,94%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
Jun​
10,85%​
5,07%​
1,95%​
2,14%​
2,71%​
2,94%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
Jul​
10,85%​
5,07%​
1,95%​
2,14%​
2,71%​
2,94%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
Aug​
10,85%​
5,07%​
1,95%​
2,14%​
2,71%​
2,94%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
Sep​
10,85%​
5,07%​
1,95%​
2,14%​
2,71%​
2,94%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
Oct​
10,85%​
5,07%​
1,95%​
2,14%​
2,71%​
2,94%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
Nov​
10,85%​
5,07%​
1,95%​
2,14%​
2,71%​
2,94%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
Dec​
10,85%​
5,07%​
1,95%​
2,14%​
2,71%​
2,94%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
2,96%​
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
You mean like the below?
Book1
ABCDEFGHIJKLM
1Year EndingDec-22Dec-23Dec-24Dec-25Dec-26Dec-27Dec-28Dec-29Dec-30Dec-31Dec-32Dec-33
2Jan10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
3Feb10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
4Mar10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
5Apr10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
6May10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
7Jun10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
8Jul10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
9Aug10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
10Sep10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
11Oct10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
12Nov10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
13Dec10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
147.96%3.51%2.05%2.43%2.83%2.95%2.96%2.96%2.96%2.96%2.96%
Sheet1
Cell Formulas
RangeFormula
C14:M14C14=AVERAGE(B8:B13,C2:C7)
 
Upvote 0
I was also playing with the below although i may have overcomplicated it somewhat:
Book1
ABCDEFGHIJKLM
1Year EndingDec-22Dec-23Dec-24Dec-25Dec-26Dec-27Dec-28Dec-29Dec-30Dec-31Dec-32Dec-33
2Jan10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
3Feb10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
4Mar10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
5Apr10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
6May10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
7Jun10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
8Jul10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
9Aug10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
10Sep10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
11Oct10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
12Nov10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
13Dec10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
147.96%3.51%2.05%2.43%2.83%2.95%2.96%2.96%2.96%2.96%2.96%
Sheet1
Cell Formulas
RangeFormula
C14:M14C14=DROP(BYCOL(VSTACK(OFFSET(B2:M13,6,-1,6),OFFSET(B2:M13,1,,6)),LAMBDA(x,AVERAGE(x))),,1)
Dynamic array formulas.
 
Upvote 0
You mean like the below?
Book1
ABCDEFGHIJKLM
1Year EndingDec-22Dec-23Dec-24Dec-25Dec-26Dec-27Dec-28Dec-29Dec-30Dec-31Dec-32Dec-33
2Jan10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
3Feb10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
4Mar10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
5Apr10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
6May10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
7Jun10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
8Jul10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
9Aug10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
10Sep10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
11Oct10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
12Nov10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
13Dec10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
147.96%3.51%2.05%2.43%2.83%2.95%2.96%2.96%2.96%2.96%2.96%
Sheet1
Cell Formulas
RangeFormula
C14:M14C14=AVERAGE(B8:B13,C2:C7)
Unfortunately no. Until now I was doing this each time. I am looking for a more automated way. More specifically, if you have the reference year and month on separate cells, which will be the average rate preceding 12 months before the reference date ? I gived a try by using AVERAGEIF and OFFSET but without any luck.
 
Upvote 0
I see, maybe more like the below then:
Book1
ABCDEFGHIJKLMNOP
1Year EndingDec-22Dec-23Dec-24Dec-25Dec-26Dec-27Dec-28Dec-29Dec-30Dec-31Dec-32Dec-33
2Jan10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%YearDec-26
3Feb10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%MonthMar
4Mar10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
5Apr10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%Result2.28%
6May10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
7Jun10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
8Jul10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
9Aug10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
10Sep10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
11Oct10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
12Nov10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
13Dec10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
Sheet1
Cell Formulas
RangeFormula
P5P5=LET(rng,B2:M13,dts,B1:M1,mnth,A2:A13,AVERAGE(VSTACK(OFFSET(OFFSET(rng,,MATCH(P2,dts,0)-1,,1),1,,MATCH(P3,mnth,0)),OFFSET(OFFSET(rng,,MATCH(P2,dts,0)-2,,1),MATCH(P3,mnth,0),,12-MATCH(P3,mnth,0)))))


Maybe someone can come up with a simpler version - i am still getting my head around the new functions
 
Upvote 0
I see, maybe more like the below then:
Book1
ABCDEFGHIJKLMNOP
1Year EndingDec-22Dec-23Dec-24Dec-25Dec-26Dec-27Dec-28Dec-29Dec-30Dec-31Dec-32Dec-33
2Jan10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%YearDec-26
3Feb10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%MonthMar
4Mar10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
5Apr10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%Result2.28%
6May10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
7Jun10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
8Jul10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
9Aug10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
10Sep10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
11Oct10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
12Nov10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
13Dec10.85%5.07%1.95%2.14%2.71%2.94%2.96%2.96%2.96%2.96%2.96%2.96%
Sheet1
Cell Formulas
RangeFormula
P5P5=LET(rng,B2:M13,dts,B1:M1,mnth,A2:A13,AVERAGE(VSTACK(OFFSET(OFFSET(rng,,MATCH(P2,dts,0)-1,,1),1,,MATCH(P3,mnth,0)),OFFSET(OFFSET(rng,,MATCH(P2,dts,0)-2,,1),MATCH(P3,mnth,0),,12-MATCH(P3,mnth,0)))))


Maybe someone can come up with a simpler version - i am still getting my head around the new functions
It seems to be a hint for the sollution, however the calculated average seems to be wrong.

Thank you for your help!
 
Upvote 0
I have had a look and it looks ok to me, maybe you could add a little more detail other than the word 'wrong' as it does not give me much detail to look into.

Book1
ABCDEFGHIJKLMNOP
1Year Ending01/12/202201/12/202301/12/202401/12/202501/12/202601/12/202701/12/202801/12/202901/12/203001/12/203101/12/203201/12/2033
2Jan0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296Year01/12/2026
3Feb0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296MonthMar
4Mar0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
5Apr0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296Result0.022825
6May0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
7Jun0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296Manual formula0.022825
8Jul0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
9Aug0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
10Sep0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
11Oct0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
12Nov0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
13Dec0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
14
15
16Year Ending01/12/202201/12/202301/12/202401/12/202501/12/202601/12/202701/12/202801/12/202901/12/203001/12/203101/12/203201/12/2033
17Jan0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296Year01/12/2024
18Feb0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296MonthMay
19Mar0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
20Apr0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296Result0.0377
21May0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
22Jun0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296Manual formula0.0377
23Jul0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
24Aug0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
25Sep0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
26Oct0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
27Nov0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
28Dec0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
Sheet1
Cell Formulas
RangeFormula
P5,P20P5=LET(rng,B2:M13,dts,B1:M1,mnth,A2:A13,AVERAGE(VSTACK(OFFSET(OFFSET(rng,,MATCH(P2,dts,0)-1,,1),1,,MATCH(P3,mnth,0)),OFFSET(OFFSET(rng,,MATCH(P2,dts,0)-2,,1),MATCH(P3,mnth,0),,12-MATCH(P3,mnth,0)))))
P7P7=AVERAGE(E5:E13,F2:F4)
P22P22=AVERAGE(C22:C28,D17:D21)
 
Upvote 0
I have had a look and it looks ok to me, maybe you could add a little more detail other than the word 'wrong' as it does not give me much detail to look into.

Book1
ABCDEFGHIJKLMNOP
1Year Ending01/12/202201/12/202301/12/202401/12/202501/12/202601/12/202701/12/202801/12/202901/12/203001/12/203101/12/203201/12/2033
2Jan0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296Year01/12/2026
3Feb0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296MonthMar
4Mar0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
5Apr0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296Result0.022825
6May0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
7Jun0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296Manual formula0.022825
8Jul0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
9Aug0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
10Sep0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
11Oct0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
12Nov0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
13Dec0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
14
15
16Year Ending01/12/202201/12/202301/12/202401/12/202501/12/202601/12/202701/12/202801/12/202901/12/203001/12/203101/12/203201/12/2033
17Jan0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296Year01/12/2024
18Feb0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296MonthMay
19Mar0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
20Apr0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296Result0.0377
21May0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
22Jun0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296Manual formula0.0377
23Jul0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
24Aug0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
25Sep0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
26Oct0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
27Nov0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
28Dec0.10850.05070.01950.02140.02710.02940.02960.02960.02960.02960.02960.0296
Sheet1
Cell Formulas
RangeFormula
P5,P20P5=LET(rng,B2:M13,dts,B1:M1,mnth,A2:A13,AVERAGE(VSTACK(OFFSET(OFFSET(rng,,MATCH(P2,dts,0)-1,,1),1,,MATCH(P3,mnth,0)),OFFSET(OFFSET(rng,,MATCH(P2,dts,0)-2,,1),MATCH(P3,mnth,0),,12-MATCH(P3,mnth,0)))))
P7P7=AVERAGE(E5:E13,F2:F4)
P22P22=AVERAGE(C22:C28,D17:D21)
Apologies for my tardy reply. It seems that when you select Dec as a reference month the model do not calculate the average value. Apart from this it is perfect! Many thanks for your valuable assistance!!
 
Upvote 0

Forum statistics

Threads
1,223,937
Messages
6,175,522
Members
452,650
Latest member
Tinfish

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