How to sum value based on the set of specific month & year?

Sochen

Board Regular
Joined
Dec 6, 2022
Messages
63
Office Version
  1. 2021
Platform
  1. Windows
Hi All,

I would like to make the dynamic sum value based on the set of specific month and year as to see the comparison.

test1.xlsx
ABCDEFGHIJKLMNOPQRST
1Year2022Apr
22021
3
4
5YearMonthTotalYearJanFebMarAprMayJunJulAugSepOctNovDecTotal
62021Jan10020229015012090450
72021Feb502021100508080310
82021Mar80
92021Apr80
102021May100Change year or month to see comparison of the specific period
112021Jun90Question 1:Return blank because the sum only from Jan to Apr
122021Jul110
132021Aug100
142021Sep120
152021Oct70
162021Nov150Question 2:Rolling down/up month based the setting month
172021Dec200
182022Jan90Set month:Jun
192022Feb150
202022Mar120Normal DateJanFebMarAprMayJunJulAugSepOctNovDec
212022Apr90After Set monthJanFebMarAprMayJun
222022May30
232022Jun80
242022Jul100Result after set month
252022Aug90Return blank as it shows only from Jan to Jun base on the set month
262022Sep110
272022Oct30
282022Nov90
292022Dec100
302023Jan50
312023Feb400
322023Mar300
332023Apr250
34
35
Sheet1 (2)
Cell Formulas
RangeFormula
G2G2=G1-1
F6:F7F6=G1
G6:J6G6=SUMIFS($C$6:$C$33,$A$6:$A$33,$F6,$B$6:$B$33,G$5)
G7:J7G7=IF(G6=0,"",SUMIFS($C$6:$C$29,$A$6:$A$29,$F7,$B$6:$B$29,G$5))
S6:S7S6=SUM(G6:R6)
 
Last edited:

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
How does this work for you? I did not update conditional formating.
Mr Excel Questions2.xlsm
ABCDEFGHIJKLMNOPQRS
1Year2022Apr
22021
3
4YearMonthTotalYearJanFebMarAprMayJunJulAugSepOctNovDecTotal
52021Jan10020229015012090   450
62021Feb502021100508080   310
72021Mar80
82021Apr80
92021May100Change year or month to see comparison of the specific period
102021Jun90Return blank because the sum only from Jan to Apr
112021Jul110
122021Aug100
132021Sep120
142021Oct70
152021Nov150
162021Dec200
172022Jan90
182022Feb150
192022Mar120
202022Apr90
212022May30
222022Jun80
232022Jul100
242022Aug90
252022Sep110
262022Oct30
272022Nov90
282022Dec100
292023Jan50
302023Feb400
312023Mar300
322023Apr250
33
Sheet11
Cell Formulas
RangeFormula
G2G2=G1-1
F5:F6F5=G1
G5:M5G5=IF(COLUMNS($G$5:G5)>MATCH($H$1,$B$5:$B$16,0),"",SUM((--($F$5=$A$5:$A$32))*(--(G$4=$B$5:$B$32)*($C$5:$C$32))))
G6:M6G6=IF(COLUMNS($G$5:G6)>MATCH($H$1,$B$5:$B$16,0),"",SUM((--($F$6=$A$5:$A$32))*(--(G$4=$B$5:$B$32)*($C$5:$C$32))))
S5:S6S5=SUM(G5:R5)
 
Upvote 0
How does this work for you? I did not update conditional formating.
Mr Excel Questions2.xlsm
ABCDEFGHIJKLMNOPQRS
1Year2022Apr
22021
3
4YearMonthTotalYearJanFebMarAprMayJunJulAugSepOctNovDecTotal
52021Jan10020229015012090   450
62021Feb502021100508080   310
72021Mar80
82021Apr80
92021May100Change year or month to see comparison of the specific period
102021Jun90Return blank because the sum only from Jan to Apr
112021Jul110
122021Aug100
132021Sep120
142021Oct70
152021Nov150
162021Dec200
172022Jan90
182022Feb150
192022Mar120
202022Apr90
212022May30
222022Jun80
232022Jul100
242022Aug90
252022Sep110
262022Oct30
272022Nov90
282022Dec100
292023Jan50
302023Feb400
312023Mar300
322023Apr250
33
Sheet11
Cell Formulas
RangeFormula
G2G2=G1-1
F5:F6F5=G1
G5:M5G5=IF(COLUMNS($G$5:G5)>MATCH($H$1,$B$5:$B$16,0),"",SUM((--($F$5=$A$5:$A$32))*(--(G$4=$B$5:$B$32)*($C$5:$C$32))))
G6:M6G6=IF(COLUMNS($G$5:G6)>MATCH($H$1,$B$5:$B$16,0),"",SUM((--($F$6=$A$5:$A$32))*(--(G$4=$B$5:$B$32)*($C$5:$C$32))))
S5:S6S5=SUM(G5:R5)

Hi Sir, thank you for your response. However, when change change month to May or June, then the result of May and Jun in 2022 appear while the result in 2023 will not shown because there is no data in May and Jun 2023. So the sum data in 2022 should be shown base on the sum data in 2023. And also I have the question number 2 in the same exel, could you have a look?
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,427
Members
448,961
Latest member
nzskater

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