Thread: date between ?
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Sharad Naik Sharad Naik is offline
external usenet poster
 
Posts: 212
Default date between ?

You can do it as below example:

Dim a As Date, b As Date, c As Date
a = DateSerial(2005, 1, 1)
b = DateSerial(2004, 1, 1)
c = DateSerial(2003, 1, 1)
If (b < a Or b < c) And (b a Or b c) Then
MsgBox "YES! (between)"
Else
MsgBox "NO! (not between)"
End If

You can replace < with <= AND with = if you want to
include the limits.

Sharad

"HotRod" wrote in message
.. .
Can anyone suggest how to go about testing whether a date is between two
other dates? I'd like to know if a date falls in a certain quarter. THANKS