PDA

View Full Version : Solved: Formula for Date Ranges



LOSS1574
03-25-2009, 11:56 AM
Please see the attached spreadsheet.

I'm having issues trying to create a formula in column (F) that indentifies whether or not the accident date in column E falls in between the Effective (column B) date or Expiration Date (column C).

Any help is appreciated :)

nirvana_1
03-25-2009, 12:37 PM
Sub CheckIfValid()
Dim j As Integer
j = 2
Do While Sheets(1).Cells(j, 2).Value <> ""
If DateDiff("d", Sheets(1).Cells(j, 2), Sheets(1).Cells(j, 5)) >= 0 And DateDiff("d", Sheets(1).Cells(j, 5), _
Sheets(1).Cells(j, 3)) >= 0 Then
Sheets(1).Cells(j, 6) = "Eligible"
End If
j = j + 1
Loop
End Sub

LOSS1574
03-25-2009, 12:46 PM
Thanks a ton!

mdmackillop
03-25-2009, 03:20 PM
Hi Loss,
Please remember to mark your threads Solved.

MD.AKBAR
05-12-2009, 09:39 PM
Good

Bob Phillips
05-13-2009, 12:45 AM
Or a formula

=IF(AND(E2>=B2,E2<=C2),"Eligible","")