How to sum value to show only result base on the month in different year?

Sochen

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

I recently I want to sum the value based on month and year criteria. However the sum of each month in year 2021 should the result only base on the year to date of 2022.
As you can see the current date is Oct-2022, and the result in 2021 from Oct to Dec (in Orange hightlight) will not be showed if there is no update for Oct until Dec 2022.

1675609360759.png


Book1
ABCDEFGHIJKLMNOPQRST
1Current Date:Oct-22
2Sales History
3YearMonthTotalYearJanFebMarAprMayJunJulAugSepOctNovDecTotal
42021Jan10020229015012090308010090110000860
52021Feb50202110050808010090110100120830
62021Mar80
72021Apr80
82021May100
92021Jun90
102021Jul110
112021Aug100
122021Sep120
132021Oct70
142021Nov150
152021Dec200
162022Jan90
172022Feb150
182022Mar120
192022Apr90
202022May30
212022Jun80
222022Jul100
232022Aug90
242022Sep110
252022Oct
262022Nov
272022Dec
28
Sheet1
Cell Formulas
RangeFormula
G4:R4G4=IFERROR(SUMIFS($C$4:$C$27,$A$4:$A$27,$F$4,$B$4:$B$27,G$3),"")
S4:S5S4=SUM(G4:R4)
 

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 about
Excel Formula:
=IF(G4=0,"",SUMIFS($C$4:$C$27,$A$4:$A$27,$F5,$B$4:$B$27,G$3))
 
Upvote 0
Solution
Try...

=IF(MONTH(NOW())>=MONTH(G1);"";SUMIFS($C$4:$C$27,$A$4:$A$27,$F5,$B$4:$B$27,G$3)))
 
Upvote 0
How about
Excel Formula:
=IF(G4=0,"",SUMIFS($C$4:$C$27,$A$4:$A$27,$F5,$B$4:$B$27,G$3))
Maybe use a month treatment before... like...
=IF(MONTH(NOW())>=MONTH(G1);"";SUMIFS($C$4:$C$27,$A$4:$A$27,$F5,$B$4:$B$27,G$3)))
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 1

Forum statistics

Threads
1,224,823
Messages
6,181,180
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