Identifying how many days in month between 2 dates

Akradon

New Member
Joined
Aug 25, 2017
Messages
6
Hi all,

Hoping you can help me. Bit of background to help explain what I'm after.

If I had a holiday on 30th August until 1st September. Which is 3 days. But is there a formula where I can make it state that I had 2 days in August and 1 day in September?

I want to have a table with all the months across the top, names down the left hand side, and the body of the table will be filled in with who has had what holiday in which months.

Hope I've explained that correctly.

Thanks in advance guys.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Where do you place the holidays with the names?
 
Upvote 0
Welcome to Mr Excel

Try something like this - try to adapt it to your data setup

Dates as dd/mm/yyyy
First day of each month in D1:O1 (custom format as mmm/yy if desired: jan/17, feb/17....)
Holidays start/end dates in columns B:C

B
C
D
E
F
G
H
I
J
K
L
M
N
O
1
HolidayStart​
HolidayEnd
01/01/2017​
01/02/2017​
01/03/2017​
01/04/2017​
01/05/2017​
01/06/2017
01/07/2017​
01/08/2017​
01/09/2017​
01/10/2017​
01/11/2017​
01/12/2017​
2
30/08/2017​
01/09/2017
0​
0​
0​
0​
0​
0
0​
2​
1​
0​
0​
0​
3
04/07/2017​
04/07/2017
0​
0​
0​
0​
0​
0​
1​
0​
0​
0​
0​
0​

<tbody>
</tbody>


Formula in D2 copied across and down
=MAX(0,1+MIN(EOMONTH(D$1,0),$C2)-MAX(D$1,$B2))

Format as number with 0 decimal places

Hope this helps

M.
 
Last edited:
Upvote 0
The information is on Sheet2 and I want the days to be displayed on Sheet1.

It will state on Sheet2, In column B, the first day of the holiday and in Column E the last day of their holiday. Then on Sheet1, I want it to display the amount of days per month they have had off.
 
Upvote 0
The information is on Sheet2 and I want the days to be displayed on Sheet1.

It will state on Sheet2, In column B, the first day of the holiday and in Column E the last day of their holiday. Then on Sheet1, I want it to display the amount of days per month they have had off.

Only one holiday in Sheet2 or a list of holidays? If the later please provide the list.

M.
 
Upvote 0
Welcome to Mr Excel

Try something like this - try to adapt it to your data setup

Dates as dd/mm/yyyy
First day of each month in D1:O1 (custom format as mmm/yy if desired: jan/17, feb/17....)
Holidays start/end dates in columns B:C

B
C
D
E
F
G
H
I
J
K
L
M
N
O
1
HolidayStart​
HolidayEnd
01/01/2017​
01/02/2017​
01/03/2017​
01/04/2017​
01/05/2017​
01/06/2017
01/07/2017​
01/08/2017​
01/09/2017​
01/10/2017​
01/11/2017​
01/12/2017​
2
30/08/2017​
01/09/2017
0​
0​
0​
0​
0​
0
0​
2​
1​
0​
0​
0​
3
04/07/2017​
04/07/2017
0​
0​
0​
0​
0​
0​
1​
0​
0​
0​
0​
0​

<tbody>
</tbody>


Formula in D2 copied across and down
=MAX(0,1+MIN(EOMONTH(D$1,0),$C2)-MAX(D$1,$B2))

Format as number with 0 decimal places

Hope this helps

M.

I thought this worked then. But I've come across a problem of that it is including weekends and bank holidays :( Just trying to upload a screenshot to show what I'm looking at.
 
Upvote 0
s!AjWq2tLWrX_orlAYkBDyAet78kYT
s!AjWq2tLWrX_orlEg0-x5InqJdAI0
This is the sheet (sheet2)where I enter the information: https://1drv.ms/i/s!AjWq2tLWrX_orlEg0-x5InqJdAI0

This is the sheet (Sheet1) where I want the summary to be: https://1drv.ms/i/s!AjWq2tLWrX_orlAYkBDyAet78kYT
 
Upvote 0
hmm...looking at the images, i think you would have to radically change your data setup (Sheet2) to use the formula i suggested.
Difficult to help.

M.
 
Upvote 0
Thought it would be. Been racking my head over it for last couple of days. Think I might just have to make some of it manual entry for them. No hardship.

Thanks for the other formula though!
 
Upvote 0
A possible solution

Dates dd/mm/yyyy
Create an auxiliary sheet, say Sheet3, like this


A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
1
Employee​
Date From​
Date to​
01/01/2017​
01/02/2017​
01/03/2017​
01/04/2017​
01/05/2017​
01/06/2017​
01/07/2017​
01/08/2017​
01/09/2017​
01/10/2017​
01/11/2017​
01/12/2017​
2
Adrian Raducea​
31/07/2017​
11/08/2017​
0​
0​
0​
0​
0​
0​
1​
11​
0​
0​
0​
0​
3
Adrian Raducea​
30/08/2017​
01/09/2017​
0​
0​
0​
0​
0​
0​
0​
2​
1​
0​
0​
0​
4
Alan Clark​
10/08/2017​
31/08/2017​
0​
0​
0​
0​
0​
0​
0​
22​
0​
0​
0​
0​
5
Alan Clark​
04/07/2017​
05/08/2017​
0​
0​
0​
0​
0​
0​
28​
5​
0​
0​
0​
0​

<tbody>
</tbody>


Use the same formula (post above):
D2 copied across and down
=MAX(0,1+MIN(EOMONTH(D$1,0),$C2)-MAX(D$1,$B2))

Then in Sheet1...

A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
1
Employee​
Entitlement​
C/F​
Total​
01/01/2017​
01/02/2017​
01/03/2017​
01/04/2017​
01/05/2017​
01/06/2017​
01/07/2017​
01/08/2017​
01/09/2017​
01/10/2017​
01/11/2017​
01/12/2017​
2
Adrian Raducea​
0​
0​
0​
0​
0​
0​
1​
13​
1​
0​
0​
0​
3
Alan Clark​
0​
0​
0​
0​
0​
0​
28​
27​
0​
0​
0​
0​
4

<tbody>
</tbody>


Formula E2 copied across and down
=SUMIF(Sheet3!$A:$A,$A2,INDEX(Sheet3!$D:$O,0,MATCH(E$1,Sheet3!$D$1:$O$1,0)))

Done!

M.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,547
Messages
6,120,139
Members
448,948
Latest member
spamiki

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