Counting days with multiple split ranges

ahmedhussain

New Member
Joined
Jul 25, 2017
Messages
4
Hi to all professionals :)
Need your professional help to put the below query in to excel formula please.

Basically i have two dates on the left of the table, which is input from user, i need to calculate the number of days between period split mentioned on the right of the below table.

Example: if input date is Jul 1st 2017 to Jul 31st 2018 on the left, total days are 396, so the required result is that there are 184 days from 01/07/2017 to 31/12/2017 and 181 days from 01/01/2018 to 30/06/2018 and 31 days from 01/07/2018 to 31/07/2018. Likewise, if the range gets bigger need to add the same on the right (period split).


1st Jul 20171st Jan 20181st Jul 20181st Jan 20191st Jul 20191st Jan 2020
FromToNo. of Days31st Dec. 201730th Jun 201831st Dec. 201830th Jun 201931st Dec. 201930th Jun 2020
1st Jul 201730th July 2018396
No. of days
between above
dates ???

<tbody>
</tbody>
 

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".
Assuming your dates are custom-formatted numbers (not text strings), try this:

=MAX(0,MIN(E2,$B$3)-MAX(E1,$A$3)+1)
 
Upvote 0

Forum statistics

Threads
1,215,967
Messages
6,127,981
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