Frodo Baggins
Frodo Baggins

Reputation: 35

Match if date is within date range google sheets

I have two columns with a start (column B) and end (column C) date range, and a cell (G1) with a date.
I want to be able to look at columns B and C and return true if G1 falls in between any of the date range of B and C, and if G1 is not within the date, return false.

Any suggestions on how to do this?

Upvotes: 1

Views: 2177

Answers (2)

Deven T. Corzine
Deven T. Corzine

Reputation: 607

Assuming this formula is used on row 2, this will work:

=ISBETWEEN($G$1,$B2,$C2)

Change $B2 and $C2 appropriately if you're not on row 2.

Note that the ISBETWEEN() function has two additional optional boolean parameters to control whether the start/end dates are inclusive or exclusive for the range; both default to TRUE for inclusive endpoints.

Upvotes: 1

marikamitsos
marikamitsos

Reputation: 10573

You can use the following formula

=IFERROR(IF( 
     QUERY(L2:M14,"WHERE L <= DATE '"&TEXT(K2, "yyyy-mm-dd")&"' 
                     AND M >= DATE '"&TEXT(K2, "yyyy-mm-dd")&"'") 
                              >0,TRUE),FALSE)

enter image description here

(Please adjust ranges to your needs)

Functions used:

Upvotes: 2

Related Questions