Calendar Year to date

xcelnovice

Board Regular
Joined
Dec 31, 2011
Messages
81
Hi all, I have 12 months of data. The months are listed acrossed the top in columns J to U & accounts down the side in col A. I need a formula that will sum Jan-March but not include all 12 months. I’d be preparing the March report in April. Then in May I’d need it to know to pull Jan-April. I can add a date to the report if this is required. Also as a side note I plan on using this formula in a macro.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Assuming your data looks like this
1SJO6z2.png


M26 contains the date you are preparing your report, and the formula below would sum up until the previous month.

The formula on M28 would be =SUM(J3:OFFSET(J3,20,MONTH(M26)-2)). Change the 20 in offset to the actual number of rows from your table. This won't work when you are on january, but you can insert an if statement around that. I'm sure there are cleaner ways to do this, but this is I could come up with.
 
Upvote 0
Thank you this is great! Any input on how I would tweak it to a sumif

Can you try this? I don't have access to a pc right now, but i think this could work:

=IF(MONTH(M26)=1,SUM(J3:OFFSET(J3,20,12)),SUM(J3:OFFSET(J3,20,MONTH(M26)-2)))

This checks if the month is january, and if so, it sums 12 columns, and if not, it will sum up until last month, like the previous formula i posted.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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