I am working on trying to find a formula or a macro that will help allow me find a particular date in a range of two dates. I have tried a few different things, but I have come up empty. Are there any solutions for this? I have 3 date strings, and I am looking to see if the third date falls in the range.
ex. date range is var1 5/1/17 through var2 5/7/17 and I am looking to see if var3 5/5/17 falls within that week. output true if true, false if false.
Thanks in advance!
Using formulas, you would do
=IF(AND([earliest date]<=[check date],[latest date]>=[check date]),"Yes","No")
.
If you need it in VBA, you could do something like:
Function checkDate(date1 As String, date2 As String, chkDate As String) As String
If date1 <= chkDate And date2 >= chkDate Then
checkDate = "Falls between!"
Else
checkDate = "Outside the range"
End If
End Function
And run with =checkDate(A2,B2,C2)
.