Calculate month/year to date with one date field

DaK888

Active Member
Joined
Jan 23, 2003
Messages
279
Office Version
  1. 365
Platform
  1. Windows
Hopefully I can explain what I'm trying to accomplish...

See current spreadsheet screenshot attached.

I'm trying to show a comparison for data from 2024 vs 2025.

Calculating straight mtd/ytd with complete months I can do. However, we need to submit this report at the end of every month, but also in the middle of the month and that's where I'm having an issue.

I want to use the date field in b2 which would be manually entered to indicate how current the data is for 2025, to power the data displayed in column z. IE, I want to prorate the data in column z, based on how many days we are reporting for the current year.

In this case, we are looking to prorate March 2024 to March 25th, 2025 (I know, not mid month but this is for my testing). So in this case, we would want to sum Jan-Feb 2024 numbers and then add in prorated March 2024 to match what we have for 2025.

Does that make sense?

Any help is appreciated.

Thanks!
 

Attachments

  • Screenshot 2025-03-27 075842.png
    Screenshot 2025-03-27 075842.png
    57 KB · Views: 23
Something like this,
Book1
ABCDEFGHIJKLM
1Data DateMargin
23/25/202527%
3
4
5JanuaryFebruaryMarchYTDTotals
620242025202420252024202520242025202420252024 Prorate
77209716368196896391,6182,4297,1152,4291,912
829233025292058682576882
96585631313561319
10$24,822.26$49,019.88$25,323.71$53,356.10$38,679.60$41,168.15$84,082.14$143,544.13$369,758.81$143,544.13$81,339.20
11$34.48$50.48$39.82$65.15$56.14$64.43$51.97$59.10$51.97$59.10$119.57
Sheet3
Cell Formulas
RangeFormula
L7:L11L7=B7 + D7 + (F7 * DAY($B$2) / DAY(EOMONTH($B$2, 0)))
 
Upvote 0
Firstly what version of Excel are you using ? Please update your Account profile to show the version since the solution often depends on the version.
Secondly if you have to use an image please include both the Row and Column references.
Your YTD figures for 2024 don't seem to show the expected result.

See if this works for you in Z6. The figures it calculates agree to @Sam_D_Ben's results but the formula is more generic.
I suspect someone can come up with a cleaner version.
Excel Formula:
=SUMPRODUCT(($B$5:$Y$5=Z$5)
            * (--($B$4:$Y$4&"-"&$B$5:$Y$5)<(EOMONTH($B$2,-13)+1))
            * $B6:$Y6)
  + (DAY($B$2)/DAY(EOMONTH($B$2,0))*INDEX($B6:$Y6,0,MONTH($B$2)*2-1))
 
Upvote 0
Solution
Or Something like this,
Book1
BCDEFGHIJKL
1Data DateMargin
23/25/202527%
3
4
5JanuaryFebruaryMarchYTDTotals
620242025202420252024202520242025202420252024 Prorate
77209716368196896391,6182,4297,1152,4292,346
829233025292058682576871
96585631313561315
Sheet1
Cell Formulas
RangeFormula
L7:L9L7=SUM(FILTER(B7:F7,($B$6:$F$6=YEAR($B$2))*(COLUMN($B$6:$F$6)-COLUMN(B6)+1<=(MONTH($B$2)-1)*2)))+(DAY($B$2)/DAY(EOMONTH($B$2,0)))*INDEX(B7:F7,,(MONTH($B$2)-1)*2+1)
 
Upvote 0
Timesheet.xlsx
ABCDEFGHIJKLMNO
1Data DateMargin
225-03-20250.27
3
4
5JanuaryJanuaryFebruaryFebruaryMarchMarchYTDTotalsProrate for date in B2 for year
6202420252024202520242025202420252024202520242025
772097163681968963916182429711524291911.64522345.6452
829233025292058682576882.387171.3871
96585631313561318.838714.8387
1024822.2649019.8825323.7153356.138679.641168.1584082.14143544.1369758.8143544.181339.1958133569.2058
1134.4850.4839.8265.1556.1464.4351.9759.151.9759.1119.5742160.9042
12
sheet1
Cell Formulas
RangeFormula
M7:N11M7=SUM(IF(($B$6:$G$6=M$6)*(MONTH($B$5:$G$5&0)<MONTH($B$2)),($B7:$G7)*($B$6:$F$6=M$6),IF(($B$6:$G$6=M$6)*(MONTH($B$5:$G$5&0)=MONTH($B$2)),INDEX($B7:$G7,MATCH(MONTH($B$2),MONTH($B$5:$G$5&0),0))*DAY($B$2)/DAY(EOMONTH($B$2,0)),0)))
Press CTRL+SHIFT+ENTER to enter array formulas.

PL note the change in Month row (Row 5).
ARRAY formula (Ctrl+shift+enter) in M7 copied up to N11. Any date from 1st jan to 31 mar can be used. Comparative for that date for 2024 and 2025 is given.
Excel Formula:
=SUM(IF(($B$6:$G$6=M$6)*(MONTH($B$5:$G$5&0)<MONTH($B$2)),($B7:$G7)*($B$6:$F$6=M$6),IF(($B$6:$G$6=M$6)*(MONTH($B$5:$G$5&0)=MONTH($B$2)),INDEX($B7:$G7,MATCH(MONTH($B$2),MONTH($B$5:$G$5&0),0))*DAY($B$2)/DAY(EOMONTH($B$2,0)),0)))
 
Upvote 0
Firstly what version of Excel are you using ? Please update your Account profile to show the version since the solution often depends on the version.
Secondly if you have to use an image please include both the Row and Column references.
Your YTD figures for 2024 don't seem to show the expected result.

See if this works for you in Z6. The figures it calculates agree to @Sam_D_Ben's results but the formula is more generic.
I suspect someone can come up with a cleaner version.
Excel Formula:
=SUMPRODUCT(($B$5:$Y$5=Z$5)
            * (--($B$4:$Y$4&"-"&$B$5:$Y$5)<(EOMONTH($B$2,-13)+1))
            * $B6:$Y6)
  + (DAY($B$2)/DAY(EOMONTH($B$2,0))*INDEX($B6:$Y6,0,MONTH($B$2)*2-1))
My apologies! Long time member but haven't posted in years so my stuff is a bit out of date. Updated now! And I guess I wasn't aware of the excel embed tool, at least that I remember... Anyway, this solution worked perfectly! Thank you!
 
Upvote 0
Thanks everyone. Ultimately Alex's version worked the best for me but I appreciate everyone pitching in!
 
Upvote 0

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