CountIf Date Range Overlaps With Another Date Range

EvonS

Board Regular
Joined
Jun 1, 2016
Messages
111
Office Version
  1. 365
Platform
  1. Windows
  2. Web
From month to month I'd like to know how many people are still on their work placements. Columns J and K represent the start and end dates of the placement, where columns N represents the last day of the month and column M represents the first day of the month. Column I represent student outcomes (but I'm only concerned with the "Placement" outcome"). This formula =IF(OR(J2>N4,K2<M4),0, COUNTIFS(I2:I22,"Placement")), work perfectly when I test it as is. However when I add ranges (J2:J1000 and K2:K1000) it just keeps giving me a 0. Anyone have any ideas?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
This formula
PHP:
=IF(OR(J2>N4,K2<M4),0, COUNTIFS(I2:I22,"Placement"))
, work perfectly when I test it as is. However when I add ranges (J2:J1000 and K2:K1000) it just keeps giving me a 0. Anyone have any ideas?

Welcome to the forum.

You can use PHP tags to prevent issues with > or < being interpreted as HTML-code.

With regard to your formula it looks to me like you should use fixed references, e.g. $I$2:$I$22.
Probably the first and last day of the month should also be fixed to $N$4 and $M$4.

Otherwise, the references shift when copying the formula.
 
Last edited:
Upvote 0
Thanks for your help and your quick reply. Unfortunately the fixed references didn't work
Code:
=IF(OR($J$2:$J$1000>$N$4,$K$2:$K$1000<$M$4),0, COUNTIFS($I$2:$I$22,"Placement"))
 
Upvote 0

Forum statistics

Threads
1,215,873
Messages
6,127,459
Members
449,383
Latest member
DonnaRisso

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