BradleyS
Active Member
- Joined
- Oct 28, 2006
- Messages
- 351
- Office Version
- 2010
- Platform
- Windows
I have the following code in F5 that looks at the EVENT date and checks if each row is in the date range (F:G), then counts each unique ID number and this works great.
However, I now want to add another check to this, which is if the "check days" (D) is >=5 it should ignore that row (ID) (or <5 it should count it) the same as the date period
I have tried adding ,D2:D5, "<5" to the COUNTIFS criteria but I get a #DIV/0 error or it decimalises the count.
How can I add in the extra check, so it checks the date period and days are <5, then counts the unique IDs?
However, I now want to add another check to this, which is if the "check days" (D) is >=5 it should ignore that row (ID) (or <5 it should count it) the same as the date period
I have tried adding ,D2:D5, "<5" to the COUNTIFS criteria but I get a #DIV/0 error or it decimalises the count.
How can I add in the extra check, so it checks the date period and days are <5, then counts the unique IDs?
Excel 2010 | |||||||||
---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | |||
1 | ID | DATE | EVENT | CHECK (days) | from | to | |||
2 | 23445 | 13/10/2018 | 14/10/2018 | 1 | 01/10/2018 | 31/12/2018 | |||
3 | 3 | 14/10/2018 | 15/11/2018 | 32 | |||||
4 | 3 | 15/10/2018 | 21/10/2018 | 6 | Quarter_ID_COUNT | ||||
5 | 3 | 16/10/2018 | 20/10/2018 | 4 | 2 | ||||
NEO1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
D2 | =DATEDIF(B2,C2,"d") | |
F5 | {=SUMPRODUCT(IF((C2:C5<=G2)*(C2:C5>=F2), 1/COUNTIFS(C2:C5, "<="&G2, C2:C5, ">="&F2, A2:A5, A2:A5), 0))} | |
Press CTRL+SHIFT+ENTER to enter array formulas. |