Who is in work question

crangelag

New Member
Joined
Nov 19, 2024
Messages
3
Office Version
  1. 365
Platform
  1. MacOS
Hello,

I have a table with all the employees (employees) on it and another table (leave) with a list of leave or sicknesses on it as per below. It's taken that you are in work if you are not on table2.

Name|Type|Start_Date|End_Date
John Doe|Leave|25/12/24|26/12/24
Jane Doe|Sickness|25/12/24|28/12/24

How do I get Excel to report who is at work on a given date? It would be nice not just to use the TODAY() but also to input a date and see who is/was in work.

Many thanks,

C
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi, welcome to the forum! Here is one way you could try to adapt to your specific set up.

Book1
ABCDEFGHIJ
1NameTypeStart_DateEnd_DateAll EmployeesGiven DateIn Work
2John DoeLeave25/12/202426/12/2024John Doe26/12/2024Frank
3Jane DoeSickness25/12/202428/12/2024Jane DoeFred
4FrankLeave01/12/202425/12/2024FrankJeff
5Fred
6Jeff
Sheet1
Cell Formulas
RangeFormula
J2:J4J2=LET(emp,F2:F6,FILTER(emp,COUNTIFS(A:A,emp,C:C,"<="&$H$2,D:D,">="&$H$2)=0))
Dynamic array formulas.
 
Upvote 0
Worked like a treat. How would I also show the opposite (those not in work, and if possible the reason why)?
 
Upvote 0
I changed the formula to =LET(emp,F2:F6,FILTER(emp,COUNTIFS(A:A,emp,C:C,"<="&$H$2,D:D,">="&$H$2)=1)) and it is now giving me all the people not in.

Many thanks, @FormR
 
Upvote 0
I changed the formula to =LET(emp,F2:F6,FILTER(emp,COUNTIFS(A:A,emp,C:C,"<="&$H$2,D:D,">="&$H$2)=1))
I guess an employee will never be "not in" for more than one reason, or have overlapping absent records, but just to be sure, I'd change the filter criteria to ">0" rather than "=1"
 
Upvote 0
Of if you wanted the reason as well, you could filter the absence list directly (avoid using full column references in this instance):

Book1
ABCDEFGHIJKLM
1NameTypeStart_DateEnd_DateAll EmployeesGiven DateIn WorkNot In
2John DoeLeave25/12/202426/12/2024John Doe26/12/2024FrankJohn DoeLeave
3Jane DoeSickness25/12/202428/12/2024Jane DoeFredJane DoeSickness
4FrankLeave01/12/202425/12/2024FrankJeff
5Fred
6Jeff
Sheet1
Cell Formulas
RangeFormula
J2:J4J2=LET(emp,F2:F6,FILTER(emp,COUNTIFS(A:A,emp,C:C,"<="&$H$2,D:D,">="&$H$2)=0))
L2:M3L2=FILTER(A2:B100,(C2:C100<=H2)*(D2:D100>=H2),"")
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,929
Messages
6,175,449
Members
452,642
Latest member
acarrigan

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