Excel Sumifs based Year and Month to derive Period To Date Amount

Biz

Well-known Member
Joined
May 18, 2009
Messages
1,773
Office Version
  1. 2021
Platform
  1. Windows
Dear All,

I'm trying to create a formula that calculates PTD using Year and Month Numbers.
In Column H, PTD calculation and Colum I Should Be the solution.
Please note I can't create helper columns.

Sumifs Between YearNo and Month No.xlsx
ABCDEFGHIJ
1YearMonthAmountMonthYearPTDShould BeMatch
22020181,430202271,251,9781,710,248FALSE
32020292,13020208606,790606,790TRUE
42020399,31020204366,650366,650TRUE
52020493,78020225962,6471,623,813FALSE
62020597,110
72020654,598
82020781,788
9202086,644
1020209572
1120201029,207
1220201167,210
1320201299,848
142021144,225
15202129,513
162021369,688
172021425,346
182021587,405
192021665,616
2020217894
212021828,271
222021995,501
2320211042,431
2420211125,765
2520211262,821
262022183,334
272022251,922
28202235,627
292022425,320
302022596,507
312022679,674
32202276,761
33202281,000
3420229
35202210
36202211
37202212
Sheet1
Cell Formulas
RangeFormula
H2:H5H2=SUMIFS($C$2:$C$37,$A$2:$A$37,"<=" &$F2,$B$2:$B$37,"<="&G2)
J2:J5J2=I2=H2


Your help would be greatly appreciated.

Kind Regards

Biz
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I think you have your years and months mixed. Col A years are four digits like 2020 in column G years are single digits.
The formula should match column A with F and column B with G, rather than the current reversed formula.
 
Upvote 0
Hi Mike,

I have wrong headers but still formula giving incorrect results.

Kind Regards,

Biz
 
Upvote 0
Your sumproduct does not work for year less than but month greater than, for instant , "2001-12" vs "2002-11"
With year is 4 digits, month is 1-2 digits, try like this:

Code:
=SUMPRODUCT(($A$2:$A$37*100+$B$2:$B$37<= F2*100+G2)*$C$2:$C$37)

With year multifly with 100, to convert year-month to 6-digit number: then 200211 >200112
 
Upvote 0
Solution
Hi Bebo,
Nice solution. Is it possible with sumifs too?

Biz
 
Upvote 0
Hi Bebo,
Nice solution. Is it possible with sumifs too?

Biz
SUMIF does not work with array like (A1:A100) * 100, but range in sheet like A1:A100
but, if using helper column to change Year - Month into real date (or Year*100+month), SUMIF can work with helper column.
 
Upvote 0
SUMIF does not work with array like (A1:A100) * 100, but range in sheet like A1:A100
but, if using helper column to change Year - Month into real date (or Year*100+month), SUMIF can work with helper column.
Thank you for your prompt feedback.
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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