Lookup Schedule using multiple variables

crispangilinan

New Member
Joined
Sep 16, 2021
Messages
9
Office Version
  1. 365
  2. 2019
  3. 2016
Hello! I need assistance in creating a formula that will lookup an employee's schedule based on:
1. Employee name
2. Schedule per Date range (start / end date)
3. Employee can have different schedule weekly that is why date range is important
3. Check if employee is on pto (start / end date)
4. Raw data indicates if the employee will work each day (E.g. Mon - Yes, Tues - Yes, Wed - No)

Technically, if i enter a date, the report should be able to output the employee schedule that day and tell if employee is on leave. We are talking about atleasr 300 employees. I would like to see all of their schedule depensing on the date i choose.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
can you share any sample data so we can help create a formula for you?
 
Upvote 0
Here you go. Sample Data. Schedule with End Date are Temporary Schedules while those without are long term schedules. The formula should be about to refer to the long term schedule if there are no temporary schedule falling within range. thanks for the help.
 
Upvote 0
i see several version of excel listed that you use. is there a particular wersionyou are needing this to work on?
also noticed in your sample data some employee #s have more than on name. is this the case in your actual data as well?
1675436323223.png
 
Upvote 0
i am actually using office 365 are well as google sheets. The employee can have multiple schedules (1) temporary with end date (2) long term with no end date. There are instances where the employee will follow a temporary schedule within a given date range and then revert back to the long term schedule once the temp schedule lapses. The table also has the days where the employee is expected to work. The one with Yes means they are supposed to work that day, and the ones with No means no work.
 
Upvote 0
i am actually using office 365 are well as google sheets. The employee can have multiple schedules (1) temporary with end date (2) long term with no end date. There are instances where the employee will follow a temporary schedule within a given date range and then revert back to the long term schedule once the temp schedule lapses. The table also has the days where the employee is expected to work. The one with Yes means they are supposed to work that day, and the ones with No means no work.
I think i made a mistake on the employee number of paul rod and nick balor. There should be a unique employee number per name. I corrected the data, thanks for noticing.
 
Last edited:
Upvote 0
are you wanting the schedule to show yes/no for each date or the start times?
1675457788882.png

currently i have it as yes/no
 
Upvote 0
hope this works for what you're wanting.
i added a helper column to the data table End Date Help
xl:2bb wouldnt let me copy everything, but you should be able to drag down the formulas for the rest
Excel Formula:
=IF(D2="",TODAY(),D2)
-------------------
Lookup Schedule using multiple variables.xlsx
ABCDEFGHIJKLMN
1Employee #Last name, First nameStart DateEnd DateEnd Date HelpStart TimeShift HoursMondayTuesdayWednesdayThursdayFridaySaturdaySunday
290001Claire James7/12/20228/11/20228/11/20226:00 AM EST7YesYesYesYesYesNoNo
390001Claire James8/12/20229/5/20229/5/20225:00 AM EST6YesYesYesYesYesNoNo
490001Claire James9/6/20229/26/20229/26/202211:00 AM EST8YesYesYesYesYesNoNo
590001Claire James9/27/20221/15/20231/15/20239:00 AM EST7YesYesYesYesYesNoNo
690001Claire James11/24/202211/28/202211/28/20229:00 AM EST6YesYesYesYesYesNoNo
790001Claire James7/9/20227/17/20227/17/202212:00 AM EST8YesYesYesYesNoNoYes
890002Paul Rod7/18/20229/12/20229/12/202212:00 AM EST7YesNoYesYesYesNoYes
990002Paul Rod9/13/20222/3/202312:00 AM EST6YesYesYesYesYesNoNo
1090021Nick Balor5/30/20222/3/20239:30 AM EST8YesYesNoNoNoNoNo
1190003Ablaza, Zhana6/1/20226/1/20226/1/20221:00 PM EST7YesYesYesYesYesNoNo
1290003Ablaza, Zhana6/2/20226/22/20226/22/202212:00 PM EST6YesYesYesYesYesNoNo
1390003Ablaza, Zhana6/23/202211/6/202211/6/202211:00 AM EST8YesYesYesNoNoYesYes
1490003Ablaza, Zhana11/7/202211/13/202211/13/202211:00 AM EST7YesYesYesNoYesYesNo
1590003Ablaza, Zhana11/14/20222/3/202310:00 AM EST6YesYesYesYesYesNoNo
1690004Abrera, Eman1/28/20222/3/20238:30 AM EST8NoNoYesYesNoNoNo
1790005Emily Smith5/12/20225/13/20225/13/20229:30 AM EST7NoNoNoYesYesNoNo
1890005Emily Smith5/16/202210/3/202210/3/20228:30 AM EST6YesYesYesYesYesNoNo
1990005Emily Smith10/4/202210/4/202210/4/20229:30 AM EST8NoYesNoNoNoNoNo
2090005Emily Smith10/5/202210/31/202210/31/202210:00 AM EST7YesYesYesYesYesNoNo
2190005Emily Smith11/1/202211/6/202211/6/20228:00 AM EST6YesYesYesYesYesNoNo
2290005Emily Smith11/7/20222/3/20239:00 AM EST8YesYesYesYesYesNoNo
2390006Michael Johnson12/8/202212/9/202212/9/20224:30 AM EST7NoNoNoYesYesNoNo
2490006Michael Johnson12/12/20222/3/202310:00 AM EST6YesYesYesYesYesNoNo
Raw Data
Cell Formulas
RangeFormula
E2:E24E2=IF(D2="",TODAY(),D2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H2:N131Cell Value="yes"textNO
H2:N131Cell Value="no"textNO

--------------------
Lookup Schedule using multiple variables.xlsx
ABCDE
1Employee #NamePTO TypeStart DateEnd Date
290001Claire JamesSick Leave12/11/202212/12/2022
390005Emily SmithAnnual Leave12/15/202212/15/2022
490007Jacob DavisEmergency Leave12/14/202212/14/2022
590019Harper WrightAnnual Leave12/11/202212/15/2022
690017Amelia NelsonAnnual Leave12/12/202212/12/2022
PTO
Cell Formulas
RangeFormula
A2:A6A2=XLOOKUP(B2,'Raw Data'!$B$2:$B$131,'Raw Data'!$A$2:$A$131,,0)

-------------------
Lookup Schedule using multiple variables.xlsx
ABCDEFGHIJKLMNOP
1DaySundayMondayTuesdayWednesdayThursdayFridaySaturday
2Date12/11/202212/12/202212/13/202212/14/202212/15/202212/16/202212/17/2022
3Employee #NameScheduleShift HoursScheduleShift HoursScheduleShift HoursScheduleShift HoursScheduleShift HoursScheduleShift HoursScheduleShift Hours
490001Claire JamesSick Leave0Sick Leave0Yes7Yes7Yes7Yes7No0
590002Paul RodNo0Yes6Yes6Yes6Yes6Yes6No0
690021Nick BalorNo0Yes8Yes8No0No0No0No0
790003Ablaza, ZhanaNo0Yes6Yes6Yes6Yes6Yes6No0
890004Abrera, EmanNo0No0No0Yes8Yes8No0No0
990005Emily SmithNo0Yes8Yes8Yes8Annual Leave0Yes8No0
1090006Michael Johnson 0Yes6Yes6Yes6Yes6Yes6No0
Expected Output
Cell Formulas
RangeFormula
A3:A37A3=UNIQUE('Raw Data'!A1:A131)
B4:B10B4=VLOOKUP('Expected Output'!A4,Data[[Employee '#]:[Last name, First name]],2,FALSE)
C4:C10,E4:E10,G4:G10,I4:I10,K4:K10,M4:M10,O4:O10C4=IFERROR(XLOOKUP(1,(C$2>=PTO[Start Date])*(C$2<=PTO[End Date])*(PTO[Employee '#]=$A4),PTO[PTO Type],INDEX(XLOOKUP(1,(C$2>=Data[Start Date])*(C$2<=Data[End Date Help])*(Data[Employee '#]=$A4),Data[[Monday]:[Sunday]],XLOOKUP(1,(C$2>=Data[Start Date])*(C$2<=Data[End Date Help])*(Data[Employee '#]=$A4),Data[[Monday]:[Sunday]],"")),1,WEEKDAY(C$2,2))),"")
D4:D10,F4:F10,H4:H10,J4:J10,L4:L10,N4:N10,P4:P10D4=IF(C4="yes",XLOOKUP(1,(C$2>=Data[Start Date])*(C$2<=Data[End Date Help])*(Data[Employee '#]=$A4),Data[Shift Hours],0),0)
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
O4:O37Cell Value="yes"textNO
O4:O37Cell Value="no"textNO
M4:M37Cell Value="yes"textNO
M4:M37Cell Value="no"textNO
K4:K37Cell Value="yes"textNO
K4:K37Cell Value="no"textNO
I4:I37Cell Value="yes"textNO
I4:I37Cell Value="no"textNO
G4:G37Cell Value="yes"textNO
G4:G37Cell Value="no"textNO
E4:E37Cell Value="yes"textNO
E4:E37Cell Value="no"textNO
C4:C37Cell Value="yes"textNO
C4:C37Cell Value="no"textNO
 
Upvote 0
happy to help. let me know if this ends up working for you.
 
Upvote 0

Forum statistics

Threads
1,215,411
Messages
6,124,759
Members
449,187
Latest member
hermansoa

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