Tracking employee's holidays

jberg123

New Member
Joined
Feb 24, 2011
Messages
45
Hi all,

I have a bunch of identical looking excel sheets from all employees in our team listing their annual leaves/holidays.

Simplified, they contain a column A with start date and column B with end date, for each of their holidays during the year.
Each row represent a holiday during the year.
An employee could have any given number of holidays, each of different lengths.

Now, I want to insert all these excel sheets into a master document and want to show in a separate tab a grid with who's out of office when.
Each row would be an employee
Each column would be a different date (1 Jan, 2 Jan, etc... , 31 Dec)

How can I in a smart way show a 1 for out of office or 0 for in office for each of the dates and each individual?

The employee tabs will be named by their employee code call it CODE.

I'm struggling to do this without a seriously ugly set of IFs...

I guess for each employee we want to test if a given date is within any of the ranges provided on his/her tab.

Thank you!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi

I've built a test model as below, which I think is what you are after/need

Employee worktab contains (Joe is the name of the first one, and each other is a 'mirror image')

Joe

A
B
1
Holidays
2
From
To
3
06 January 2018
06 January 2018
4
14 January 2018
15 January 2018

<tbody>
</tbody>












Group Summary

A
B
C
D
E
F
G
H
I
J
1
01 January 2018
02 January 2018
03 January 2018
04 January 2018
05 January 2018
06 January 2018
07 January 2018
08 January 2018
09 January 2018
2
Joe
0
0
0
0
0
1
0
0
0
3
Fred
0
0
0
0
0
0
0
0
0
4
Mike
0
0
0
0
0
0
0
0
0

<tbody>
</tbody>



B2 contains this formula (which then needs to copied to each of the others calculated cell)
=SUMPRODUCT((--INDIRECT($A2&"!$A$3:$A$30")<=B$1)*(--INDIRECT($A2&"!$B$3:$B$30")>=B$1)*(--INDIRECT($A2&"!$A$3:$A$30")<>""))


the use of the 'INDIRECT' allows the formula to the same throughout the rows, e.g it looks up the name of the work tab that contains the employee data for his/her holidays for that row
the $A$3:$A$30 is the table/range that contains the rows for the holiday dates (so if there would be more than 3 to 30 (e.g 28 rows) then you would need to increase the row above 30).

works okay in my test model, so hope it works for you!

Regards
 
Upvote 0
Hi

I've built a test model as below, which I think is what you are after/need

Employee worktab contains (Joe is the name of the first one, and each other is a 'mirror image')

Joe
A
B
1
Holidays
2
From
To
3
06 January 2018
06 January 2018
4
14 January 2018
15 January 2018

<tbody>
</tbody>












Group Summary
A
B
C
D
E
F
G
H
I
J
1
01 January 2018
02 January 2018
03 January 2018
04 January 2018
05 January 2018
06 January 2018
07 January 2018
08 January 2018
09 January 2018
2
Joe
1
3
Fred
4
Mike

<tbody>
</tbody>



B2 contains this formula (which then needs to copied to each of the others calculated cell)
=SUMPRODUCT((--INDIRECT($A2&"!$A$3:$A$30")<=B$1)*(--INDIRECT($A2&"!$B$3:$B$30")>=B$1)*(--INDIRECT($A2&"!$A$3:$A$30")<>""))


the use of the 'INDIRECT' allows the formula to the same throughout the rows, e.g it looks up the name of the work tab that contains the employee data for his/her holidays for that row
the $A$3:$A$30 is the table/range that contains the rows for the holiday dates (so if there would be more than 3 to 30 (e.g 28 rows) then you would need to increase the row above 30).

works okay in my test model, so hope it works for you!

Regards

Thank you! Extremely helpful and smart solution :) Thanks again
 
Upvote 0

Forum statistics

Threads
1,215,421
Messages
6,124,806
Members
449,191
Latest member
rscraig11

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