0

If my

[STARTDate] = 12/24/2020 AND [ENDDATE] =1/4/2021

It gives me a total of 3 days.

SUM(
(IF(AND(DATEVALUE("12/24/2020") >= [STARTDATE],DATEVALUE("12/24/2020") <= [ENDDATE]),1)) ,
(IF(AND(DATEVALUE("12/25/2020") >= [STARTDATE],DATEVALUE("12/25/2020") <= [ENDDATE]),1)) ,
(IF(AND(DATEVALUE("01/01/2021") >= [STARTDATE],DATEVALUE("01/01/2021") <= [ENDDATE]),1)) ,
(IF(AND(DATEVALUE("01/18/2021") >= [STARTDATE],DATEVALUE("01/18/2021") <= [ENDDATE]),1)) ,
(IF(AND(DATEVALUE("05/31/2021") >= [STARTDATE],DATEVALUE("05/31/2021") <= [ENDDATE]),1)) ,
(IF(AND(DATEVALUE("06/18/2021") >= [STARTDATE],DATEVALUE("06/18/2021") <= [ENDDATE]),1)) ,
(IF(AND(DATEVALUE("07/05/2021") >= [STARTDATE],DATEVALUE("07/05/2021") <= [ENDDATE]),1)) ,
(IF(AND(DATEVALUE("09/06/2021") >= [STARTDATE],DATEVALUE("09/06/2021") <= [ENDDATE]),1)) ,
(IF(AND(DATEVALUE("11/25/2021") >= [STARTDATE],DATEVALUE("11/25/2021") <= [ENDDATE]),1)) ,
(IF(AND(DATEVALUE("11/26/2021") >= [STARTDATE],DATEVALUE("11/26/2021") <= [ENDDATE]),1)) ,
(IF(AND(DATEVALUE("12/24/2021") >= [STARTDATE],DATEVALUE("12/24/2021") <= [ENDDATE]),1)) ,
(IF(AND(DATEVALUE("12/27/2021") >= [STARTDATE],DATEVALUE("12/27/2021") <= [ENDDATE]),1)) ,
(IF(AND(DATEVALUE("01/01/2022") >= [STARTDATE],DATEVALUE("01/01/2022") <= [ENDDATE]),1)) ,
(IF(AND(DATEVALUE("01/17/2022") >= [STARTDATE],DATEVALUE("01/17/2022") <= [ENDDATE]),1)) 
)
0

In my testing, I'm getting 1 as only "01/01/2021" is between "12/24/2020" and "1/4/2021". Other date values don't meet the condition.

See the returned values for each condition (excel formula) in the screenshot below.

enter image description here

1
  • You are correct, I did not pay attention to my selection. thank you!!
    – Nil R
    Feb 11 '21 at 3:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.