Melissa
Melissa

Reputation: 7

Formula to return Yes or No value if date falls within date range of two cells

I'm looking for a formula that will return Yes or No value if the date in one cells falls within date range contained in 2 other cells. Example provided in attached image. Yes/No value returned in cell C2 determined if date contained in Cell C1 falls within date range contained in Cells A2 and B2

**Yes result in C3 is incorrect and should be a "No"

enter image description here

Upvotes: 0

Views: 1455

Answers (2)

EDS
EDS

Reputation: 2195

Use an IF statement in conjunction with AND. Something like the below should work (adjust range as necessary).

Formula: =IF(AND(C$1>$A2, C$1<$B2),"Yes", "No")

Output:

enter image description here

Upvotes: 0

Christian Reinbothe
Christian Reinbothe

Reputation: 70

You need a VBA-Function:

Public Function F(ByVal D1 As Date, ByVal D2 As Date, ByVal D3 As Date) As Boolean F = (D1 <= D2) And (D2 <= D3) Exit Function End Function

You can call this function by

=F(A2;C1;B2)

Upvotes: 0

Related Questions