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.
 
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.

You're the man! I will have a try of this first thing Tuesday morning as I'm currently away from my work equipment right now. I'll let you know how it turns out.
 
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,214,929
Messages
6,122,317
Members
449,081
Latest member
tanurai

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