Average sales for the previous 3 months for each product

paun_shotts

New Member
Joined
Nov 4, 2021
Messages
41
Office Version
  1. 2013
Platform
  1. Windows
Hi,

So I am using Excel 2013, and I have a workbook that contains 6 products, we then have our sales for each month, dating back to July 2020.
In column D, I want to work out the average of the last 3 full months, and I want this to change as time goes on, so that we are always averaging the last 3 months, at any given point in time.
I would be very grateful if someone could help me in creating this formula. I have inserted the minisheet below.

PFM Experiment averages.xlsx
ABCDEFGHJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBABBBCBDBEBFBGBHBIBJBKBLBMBNBOBPBQBRBSBTBUBVBWBXBYBZCA
1Product CategoryAVG Last 3 MTHSALL OHNON 01POBOJul-20Aug-20Sep-20Q1Oct-20Nov-20Dec-20Q2Jan-21Feb-21Mar-21Q3Apr-21May-21Jun-21Q4YTDJul-21Aug-21Sep-21Q1Oct-21Nov-21Dec-21Q2Jan-22Feb-22Mar-22Q3Apr-22May-22Jun-22Q4YTD5%Jul-22Aug-22Sep-22Q1Oct-22Nov-22Dec-22Q2Jan-23Feb-23Mar-23Q3Apr-23May-23Jun-23Q4YTD9%Jul-23Aug-23Sep-23Q1Oct-23Nov-23Dec-23Q2Jan-24Feb-24Mar-24Q3Apr-24May-24Jun-24Q4YTD
29000001Product # 1196307121022482461266315453651411051606814165125624%345123741437515110920619%00000000000000000
39000002Product # 2272136316141545162222607917331327125219015131139142143910102343719935156-18%8982561522391110307172246124-21%20002000000000000020
49000003Product # 33127205201110411811235208122012111437150911424101172836213011181948130-13%31210250127198492112121438103-21%60060000000000006
59000004Product # 45930192104216162895388102612162452147149184114182153121021431719306620338%162914591916296411231953299155322913%13001300000000000013
69000005Product # 513580108751344513044463312323415912351567718456040635716064524916538418816740436014363513%42685216257777320737529218139628718873816%36003600000000000036
79000006Product # 692761002433834115386828134384243123363250118490284137106474433124215350124234464131485-1%28394311050564715327415312153508118456817%36003600000000000036
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
BW1:BY1Expression=ROW(BW1)=HighlightRowtextNO
BS1:BU1Expression=ROW(BS1)=HighlightRowtextNO
BO1:BQ1Expression=ROW(BO1)=HighlightRowtextNO
BK1:BM1Expression=ROW(BK1)=HighlightRowtextNO
BE1:BG1Expression=ROW(BE1)=HighlightRowtextNO
BA1:BC1Expression=ROW(BA1)=HighlightRowtextNO
AW1:AY1Expression=ROW(AW1)=HighlightRowtextNO
AT1:AU1Expression=ROW(AT1)=HighlightRowtextNO
AS1Expression=ROW(AS1)=HighlightRowtextNO
U1Expression=ROW(U1)=HighlightRowtextNO
Q1Expression=ROW(Q1)=HighlightRowtextNO
M1Expression=ROW(M1)=HighlightRowtextNO
BN1,J1:L1,N1:P1,R1:T1,V1:X1,BR1,BV1Expression=ROW(J1)=HighlightRowtextNO
BZ1Expression=ROW(BZ1)=HighlightRowtextNO
D2:D7Expression=ROW(D2)=HighlightRowtextNO
BV2:BV7Expression=ROW(BV2)=HighlightRowtextNO
BR2:BR7Expression=ROW(BR2)=HighlightRowtextNO
BN2:BN7Expression=ROW(BN2)=HighlightRowtextNO
BW2:BY7Expression=ROW(BW2)=HighlightRowtextNO
BS2:BU7Expression=ROW(BS2)=HighlightRowtextNO
BO2:BQ7Expression=ROW(BO2)=HighlightRowtextNO
BL2:BM7Expression=ROW(BL2)=HighlightRowtextNO
BK2:BK7Expression=ROW(BK2)=HighlightRowtextNO
BZ2:BZ7Expression=ROW(BZ2)=HighlightRowtextNO
BJ1Cell Value<=0textNO
BJ1Cell Value>0textNO
BJ1Expression=ROW(BJ1)=HighlightRowtextNO
AR2:AR7Cell Value<=0textNO
AR2:AR7Cell Value>0textNO
AR2:AR7Expression=ROW(AR2)=HighlightRowtextNO
BJ2:BJ7Cell Value<=0textNO
BJ2:BJ7Cell Value>0textNO
BJ2:BJ7Expression=ROW(BJ2)=HighlightRowtextNO
X2:X7Expression=ROW(X2)=HighlightRowtextNO
W2:W7Expression=ROW(W2)=HighlightRowtextNO
V2:V7Expression=ROW(V2)=HighlightRowtextNO
T2:T7Expression=ROW(T2)=HighlightRowtextNO
S2:S7Expression=ROW(S2)=HighlightRowtextNO
R2:R7Expression=ROW(R2)=HighlightRowtextNO
P2:P7Expression=ROW(P2)=HighlightRowtextNO
O2:O7Expression=ROW(O2)=HighlightRowtextNO
N2:N7Expression=ROW(N2)=HighlightRowtextNO
L2:L7Expression=ROW(L2)=HighlightRowtextNO
K2:K7Expression=ROW(K2)=HighlightRowtextNO
J2:J7Expression=ROW(J2)=HighlightRowtextNO
M2:M7,Q2:Q7,U2:U7Expression=ROW(M2)=HighlightRowtextNO
AO2:AO7Expression=ROW(AO2)=HighlightRowtextNO
AN2:AN7Expression=ROW(AN2)=HighlightRowtextNO
AM2:AM7Expression=ROW(AM2)=HighlightRowtextNO
AK2:AK7Expression=ROW(AK2)=HighlightRowtextNO
AJ2:AJ7Expression=ROW(AJ2)=HighlightRowtextNO
AI2:AI7Expression=ROW(AI2)=HighlightRowtextNO
AG2:AG7Expression=ROW(AG2)=HighlightRowtextNO
AF2:AF7Expression=ROW(AF2)=HighlightRowtextNO
AE2:AE7Expression=ROW(AE2)=HighlightRowtextNO
AC2:AC7Expression=ROW(AC2)=HighlightRowtextNO
AB2:AB7Expression=ROW(AB2)=HighlightRowtextNO
AA2:AA7Expression=ROW(AA2)=HighlightRowtextNO
AV1,AZ1,BD1Expression=ROW(AV1)=HighlightRowtextNO
BD2:BD7Expression=ROW(BD2)=HighlightRowtextNO
AZ2:AZ7Expression=ROW(AZ2)=HighlightRowtextNO
AV2:AV7Expression=ROW(AV2)=HighlightRowtextNO
BE2:BG7Expression=ROW(BE2)=HighlightRowtextNO
BA2:BC7Expression=ROW(BA2)=HighlightRowtextNO
AW2:AY7Expression=ROW(AW2)=HighlightRowtextNO
AT2:AU7Expression=ROW(AT2)=HighlightRowtextNO
AS2:AS7Expression=ROW(AS2)=HighlightRowtextNO
AR1Cell Value<=0textNO
AR1Cell Value>0textNO
AR1Expression=ROW(AR1)=HighlightRowtextNO
BH2:BH7Expression=ROW(BH2)=HighlightRowtextNO
BH1Expression=ROW(BH1)=HighlightRowtextNO
AQ1,AQ4,AQ7Expression=ROW(AQ1)=HighlightRowtextNO
AQ2:AQ3,AQ5:AQ6Expression=ROW(AQ2)=HighlightRowtextNO
Z1:Z7Expression=ROW(Z1)=HighlightRowtextNO
H2:H7Cell Value>0textNO
Y1:Y7,AA1:AP1,AP2:AP7,AD2:AD7,AH2:AH7,AL2:AL7,I1:I7,A1:H1,E2:H7,A2:C7Expression=ROW(A1)=HighlightRowtextNO
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
With this words, " the last 3 full months", do you mean, if today is 28-Jul-2023, you want to say it is from 1-Apr-2023 to 30-6/2023?
If yes, try:
Code:
=AVERAGEIFS($J2:$BY2,$J$1:$BY$1,">=" & EOMONTH(TODAY(),-4)+1,$J$1:$BY$1,"<=" & EOMONTH(TODAY(),-2)+1)
Note: if you want to says, last quarter, it requires different formula.
 
Upvote 0
Solution
With this words, " the last 3 full months", do you mean, if today is 28-Jul-2023, you want to say it is from 1-Apr-2023 to 30-6/2023?
If yes, try:
Code:
=AVERAGEIFS($J2:$BY2,$J$1:$BY$1,">=" & EOMONTH(TODAY(),-4)+1,$J$1:$BY$1,"<=" & EOMONTH(TODAY(),-2)+1)
Note: if you want to says, last quarter, it requires different formula.
Thank you! Perfect :)
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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