Comparing two lists of date ranges based on name

al02847

New Member
Joined
Jan 24, 2023
Messages
2
Office Version
  1. 2019
I am trying to organise an on call roster where an individual is selected for a seven day period. This is in a table with name - start date - end date of when they are 'on call'.

In a second sheet, I want a second table where people input the dates they are unavailable to be on call due to annual leave etc. It will also be in a table with name - start date - end date of when they are unavailable.

In a fourth column in the roster table - I want a formula that will automatically say 'Unavailable' when someone is selected to go on call that clashes with any of the dates they have put in the unavailable table.

1674569793362.png



1674569755543.png


In this scenario, Steven would be unavailable to be on call on 06/01/23 - 13/01/23 because it clashes with his annual leave from 02/01/23 - 08/01/23.

I can find answers on how to compare two date ranges, but I can't find a way to check against all the dates in the 'unavailable' table against each person's name.

Thanks if anyone can help
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi & welcome to MrExcel.
How about
Fluff.xlsm
ABC
1
2c01/01/202301/01/2023
3a08/01/202309/01/2023
4b02/01/202308/01/2023
5
Sheet2


Fluff.xlsm
ABCD
1
2a30/12/202206/01/2023 
3b06/01/202313/01/2023Unavailable
4c13/01/202320/01/2023 
5
Sheet1
Cell Formulas
RangeFormula
D2:D4D2=IF(COUNTIFS(Sheet2!A:A,A2,Sheet2!B:B,"<="&C2,Sheet2!C:C,">="&B2),"Unavailable","")
 
Upvote 0
Hi & welcome to MrExcel.
How about
Fluff.xlsm
ABC
1
2c01/01/202301/01/2023
3a08/01/202309/01/2023
4b02/01/202308/01/2023
5
Sheet2


Fluff.xlsm
ABCD
1
2a30/12/202206/01/2023 
3b06/01/202313/01/2023Unavailable
4c13/01/202320/01/2023 
5
Sheet1
Cell Formulas
RangeFormula
D2:D4D2=IF(COUNTIFS(Sheet2!A:A,A2,Sheet2!B:B,"<="&C2,Sheet2!C:C,">="&B2),"Unavailable","")

Hello and thank you for your quick response! This works great thanks so much!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,571
Members
452,652
Latest member
eduedu

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