Decomposing number of days of an initial date and a final date according to the following month

Antoniozarzal

New Member
Joined
Apr 25, 2016
Messages
9
Hi MrExcel, I'm having a hard time trying to figure out how to do this.

I have a database where I register a date and a number of days lost per worker because an accident or an illness. For example:
Date of accident/illnessNumber of days lost
28/05/20166

<tbody>
</tbody>

That information goes to an accumulate of days lost per month, no issues there. As you can see, those 6 days will appear all of them as if all 6 days were in May. Now I need that the 4 days of may appear in May's statistics (sum of days) and the 2 left to appear in June's statistics (also a sum of days).

Is there a way to do this?

Thank you a lot guys for any response and excuse me if I've made a mistake with the language.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi,

The following sample does it:

ABCDEFGHIJKLMNO
1Date of acc./ill.<strike></strike># Days<strike></strike>Jan 16Feb 16Mar 16Apr 16May 16Jun 16Jul 16Aug 16Sep 16Oct 16Nov 16Dec 16Jan 17
228/05/2016<strike></strike>642
328/05/2016<strike></strike>44
425/03/2016<strike></strike>807303112
520/01/2016<strike></strike>37012293130313031313031303123

<tbody>
</tbody>

C1:O1 house real dates (01/01/2016, 01/02/2016....)
in C2:
Code:
=IF(C$1=DATE(YEAR($A2),MONTH($A2),1), MIN($B2,(EOMONTH(C$1,0)-$A2+1)),
IF(AND(C$1-DATE(YEAR($A2),MONTH($A2),1)>0,SUM($B2:B2)-$B2<$B2),MIN(($B2*2)-SUM($B2:B2),(EOMONTH(C$1,0)-C$1+1)),""))
copy right and down as necessary

See SAMPLE_SplitDaysAcrossMonths.xlsx if necessary

Regards
XLearner
 
Upvote 0
Hello Xlearner

Thank you a lot buddy, this is exactly what I was looking for!

I hope this can be useful for more people.

Greetings
Antonio.
 
Upvote 0

Forum statistics

Threads
1,215,970
Messages
6,127,992
Members
449,414
Latest member
sameri

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