Distribute the Number 1 between two Dates

Jaberwokie

New Member
Joined
Aug 18, 2019
Messages
3
I am looking for the formulae that does the following spread / distribution between a start date and an end date: if the start date is mid month it recognises the value to not be 1, then between the start and end months inserts the value 1 and for the final month identifies the value of the end date. e.g. refer to the table below.

[TABLE="width: 1510"]
<tbody>[TR]
[TD]Description[/TD]
[TD="colspan: 2"]Net Programme[/TD]
[TD]Oct-19[/TD]
[TD]Nov-19[/TD]
[TD]Dec-19[/TD]
[TD]Jan-20[/TD]
[TD]Feb-20[/TD]
[TD]Mar-20[/TD]
[TD]Apr-20[/TD]
[TD]May-20[/TD]
[TD]Jun-20[/TD]
[TD]Jul-20[/TD]
[TD]Aug-20[/TD]
[TD]Sep-20[/TD]
[TD]Oct-20[/TD]
[TD]Nov-20[/TD]
[TD]Dec-20[/TD]
[/TR]
[TR]
[TD]Start Date[/TD]
[TD]End Date[/TD]
[TD="colspan: 3"]2019[/TD]
[TD]2020[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 3"]Q 4[/TD]
[TD="colspan: 3"]Q 1[/TD]
[TD="colspan: 3"]Q 2[/TD]
[TD="colspan: 3"]Q 3[/TD]
[TD="colspan: 3"]Q 4[/TD]
[/TR]
[TR]
[TD]Overall Project[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Contract Award -> Practical Completion[/TD]
[TD]14/10/2019[/TD]
[TD]10/12/2020[/TD]
[TD]0.5 [/TD]
[TD]1.0 [/TD]
[TD]1.0 [/TD]
[TD]1.0 [/TD]
[TD]1.0 [/TD]
[TD]1.0 [/TD]
[TD]1.0 [/TD]
[TD]1.0 [/TD]
[TD]1.0 [/TD]
[TD]1.0 [/TD]
[TD]1.0 [/TD]
[TD]1.0 [/TD]
[TD]1.0 [/TD]
[TD]1.0 [/TD]
[TD]0.4 [/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi, welcome to the board.

Why are the results 0.5 for the start month, and 0.4 for the end month ?

I'm guessing the start month is 0.5 because starting on 14th October means there are 18 days in October where the contract is live, and 18 days live over 31 days in October = 0.58, and you're choosing to round DOWN for the start month.
I'm guessing the end month is 0.4 because ending on 10th December means there are 10 days in December where the contract is live, and 10 days live over 31 days in December = 0.323, and you're choosing to round UP for the end month.

Is this right ?
If yes, it should be straightforward to write a formula to do this, but I'll wait until you confirm.

Comment - it's usually best to explain this kind of thing in the OP, rather than expecting people to guess :-)
 
Upvote 0
Welcome to the MrExcel board!

How did you (manually) calculate the 0.5 and the 0.4?

Edit: Ah, hadn't seen Gerald's post. :)
 
Last edited:
Upvote 0
Hi, welcome to the board.

Why are the results 0.5 for the start month, and 0.4 for the end month ?

I'm guessing the start month is 0.5 because starting on 14th October means there are 18 days in October where the contract is live, and 18 days live over 31 days in October = 0.58, and you're choosing to round DOWN for the start month.
I'm guessing the end month is 0.4 because ending on 10th December means there are 10 days in December where the contract is live, and 10 days live over 31 days in December = 0.323, and you're choosing to round UP for the end month.

Is this right ?
If yes, it should be straightforward to write a formula to do this, but I'll wait until you confirm.

Comment - it's usually best to explain this kind of thing in the OP, rather than expecting people to guess :-)

That is correct, it was more to demonstrate the the beginning of the period and the end were not to equal 1.
 
Upvote 0
OK here goes.

Let's make some assumptions.
1) Your START DATE is held in cell B4.
2) Your END DATE is held in cell C4.
3) The month dates are held in row 1, with the first one, Oct 19, in cell D1.
4) The month dates are actually held as the date of the first day of the month (e.g. 1st Oct 2019), and then have a number format applied so that they only show the month and year. They are real Excel dates, not just text strings. This is important !

In cell D4
Code:
=IF(AND($B4<=D1,$C4>=E1),1,IF(AND($C4>=E1,$B4>=D1),ROUNDDOWN((E1-$B4-1)/(E1-D1),1),IF(AND($B4< D1,$C4> D1,$C4< E1),ROUNDUP(($C4-D1+1)/(E1-D1),1),0)))<d1,$c4><e1),roundup(($c4-d1+1) (e1-d1),1),0)))

and copy across as far as required.

COMMENT
This won't deal correctly with projects that start and end in the same month.
If you need something that does this, post back.

This solution also might throw in odd results for the very last month on your calendar, but there are workarounds for that.

I've had to add some space characters in the formula, after < and > symbols, to deal with a known bug on this board.
Make sure you have no space characters in your final formula.
</e1),roundup(($c4-d1+1)></d1,$c4>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,956
Messages
6,175,607
Members
452,660
Latest member
Zatman

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