Average a Range of Data by Finding a Starting Month

seasea123

New Member
Joined
Dec 11, 2023
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Can you please help build a formula in column AA? We would like the formula to average the 3 months prior to the month of change. In this case the month of change is Oct 23, so it should average Sep 23, Aug 23 and Jul 23. We'd like the formula to be dynamic for different months of change.

1702336088170.png
 
Then just drag the formula I suggested down.
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
It does not look like these formulas work unfortunately. Can you attach the excel file with the formula instead of an image?
 
Upvote 0
It would be better if you posted some sample data, rather than an image.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
It would be better if you posted some sample data, rather than an image.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
Thank you! I am trying to download it, but can't becuase it says it cannot open in a protected view.
 
Upvote 0
Does this work?

Mr Excel.xlsx
TUVWXYZAA
1Name7/1/20238/1/20239/1/202310/1/202311/1/2023Month of ChangeBaseline (3 Month Avg. Prior to Change)
2Smith, Bob3226273230Oct-23
3Evans, Janet3023322240Nov-23
4
Sheet 1
 
Upvote 0
Thanks for that.
It appears that the "dates" in U1:Y1 are actually text rather than real dates. The simplest option is to change them to proper dates.
 
Upvote 0
Thanks for that.
It appears that the "dates" in U1:Y1 are actually text rather than real dates. The simplest option is to change them to proper dates.
Thank you! I tried that and am receiving a "CALC" error. Please see the table below.
Mr Excel.xlsx
TUVWXYZAA
7Name7/1/20238/1/20239/1/202310/1/202311/1/2023Month of ChangeBaseline (3 Month Avg. Prior to Change)
8Smith, Bob322627323010/1/2023#CALC!
9Evans, Janet302332224011/1/2023#CALC!
10#CALC!
Sheet 1
Cell Formulas
RangeFormula
AA8:AA10AA8=AVERAGE(TAKE(FILTER(U8:Y8,$U$1:$Y$1<Z8),,-3))
 
Upvote 0
Those still appear to be text & not dates.
Is that a normal range or a table?
 
Upvote 0
Those still appear to be text & not dates.
Is that a normal range or a table?
I converted to a range instead of a table but the formula is not calculating correctly still. Can you please assist?

Mr Excel.xlsx
ABCDEFGH
2Name7/1/20238/1/20239/1/202310/1/202311/1/2023Month of Change
3Smith, Bob322627323010/1/202332
4Evans, Janet302332224011/1/202331
Sheet1
Cell Formulas
RangeFormula
H3:H4H3=AVERAGE(TAKE(FILTER(B3:F3,$B$2:$F$2<=G3),,-3))
 
Upvote 0
That's because the values in row 1 are still text & not dates.
Try
Fluff.xlsm
TUVWXYZAA
1Name01/07/202301/08/202309/01/202310/01/202311/01/2023Month of ChangeBaseline (3 Month Avg. Prior to Change)
2Smith, Bob3226273230Oct-2329.8
3Evans, Janet3023322240Nov-2331.3
Sheet6
Cell Formulas
RangeFormula
AA2:AA3AA2=AVERAGE(TAKE(FILTER(U2:Y2,DATEVALUE($U$1:$Y$1)<Z2),,-3))
 
Upvote 0

Forum statistics

Threads
1,215,340
Messages
6,124,386
Members
449,155
Latest member
ravioli44

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