Tricky formula: Splitting two dates in its count of days per calendar year

actjfc

Active Member
Joined
Jun 28, 2003
Messages
416
Excel friends,

I have a table with two columns Start Date and End Date. For example,
Start Date - End Date
7/1/2014 - 6/30/2017

I need help developing a formula that counts the days between these two dates split by the calendar year.

So, I built six columns with the calendar year to count the days.

These should be the results of the formula:

2013 - Results 0
2014 – Days from 7/1/2014 to 12/31/2014 = Results 183
2015 - Results 365
2016 - Results 365
2017 – Days from 1/1/2017 to 6/30/2017 = 180
2018 - Results 0

It becomes tricky when you have two dates like:

Start Date - End Date
10/15/2015 - 11/14/2015

These should be the results of the formula:

2013 - Results 0
2014 –Results 0
2015 - Results 30
2016 - Results 0
2017 – Results 0
2018 - Results 0

Thanks for your help!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
It's a long shot, and i didn't test it, but i guess you can parse "date - date" with len(), left()/right(), find() and use datevalue() & year() to extract the year, then sumif() to get days or something like that.
But why bother, can you use helper columns and concatenate ?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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