# Countif date range appears in another date range

#### PedroGomez9

##### New Member
Morning all!

I'm looking to try and count the number of colleagues at my work that have been absent due to covid on a weekly basis.
I have their isolation start date in column N, their isolation end date in column O in a sheet named 'Absence Data'. Absence type is flagged as 'Covid' in column M.

On a separate sheet, 'Absence by Week', I have a list of the working weeks - week start date in column A, week end date in column B.

My issue is that often depending on the start date, a 10 day isolation can span across 3 separate weeks, but the start/end date will only be captured in 2 of those weeks and not in between. Example, a colleague starts isolation on Saturday of week 1, isolating all of week 2, and then also the first couple of days of week 3. using the formulas below, only the first and third weeks are captured.

=COUNTIFS('Absence Data'!\$N:\$N,">="&'Absence by Week'!\$A2,'Absence Data'!\$N:\$N,"<="&'Absence by Week'!\$B2) to capture those starting isolation in any given week, and;
=COUNTIFS('Absence Data'!M:M,"Covid",'Absence Data'!\$O:\$O,">="&'Absence by Week'!\$A2,'Absence Data'!\$O:\$O,"<="&'Absence by Week'!\$B2) to capture those ending isolation in any given week

Please let me know if anything isn't clear, or you need more supporting information to assist, and thank you in advance!

### Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

#### steve the fish

##### Well-known Member

=SUMPRODUCT(--(('Absence Data'!\$O\$1:\$O\$10<A2)+(B2<'Absence Data'!\$N\$1:\$N\$10)=0),--('Absence Data'!\$M\$1:\$M\$10="Covid"))

Replies
5
Views
246
Replies
1
Views
337
Replies
1
Views
290
Replies
0
Views
339
Replies
2
Views
213

1,147,479
Messages
5,741,386
Members
423,657
Latest member
Medrok2021

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

### Which adblocker are you using?

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

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