Forum Discussion

Mahdia_Akter's avatar
Mahdia_Akter
Copper Contributor
Mar 10, 2022

Date interval check between columns

So i have dates in a column, B and say there are start and end dates in column D and E,
I have to check if date in B1 matches in the interval of D and E, if any date falls in the interval of D and E, need to highlight that.
So i used a lot of formula nothing gives exact result and by using IF it gives SPILL error, just mentioning one that I tried:
AND($B1>=$D$1:$D$200, $B1<=$E$1:$E$200)
This does not give right results. Any suggestion please.

10 Replies

  • Lorenzo's avatar
    Lorenzo
    Silver Contributor

    Hi Mahdia_Akter 

     

    Assuming I understood (not sure...)

    in C1 and copy down as necessary:

    =IF( SUM((B1>=D$1:D$200)*(B1<=E$1:E$200)), "Match", "No match")
    • Mahdia_Akter's avatar
      Mahdia_Akter
      Copper Contributor
      If i want to place this in conditional formatting so that it auto highlights the cells than I need, will it work? Or do i have to go for countifs?
      • Lorenzo's avatar
        Lorenzo
        Silver Contributor

        Mahdia_Akter 

         

        @Riny_van_Eekelen and I have a different understanding of what needs to be compared to what. Until this is clarified everybody's going to waste time. So, could you please clarify what the formula should do:

        - Highlight B1 if it falls between dates in D1 and E1
        or
        - Highlight B1 if it falls between ANY dates in D1:D200 and E1:E200

         

        Thanks

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    Mahdia_Akter Not sure what the &gt; and &lt; are supposed to do. Especially the semi-colon seems out of place. Perhaps this will work for you

     

    =($B1&gt=$D$1:$D$200)*($B1&lt=$E$1:$E$200)

     

    This should spill and array of ones and zeros. 1 indicating that the Date falls between the Start- and End Date, 0 that is does not.

     

     

     

Resources