Date Diff Help

K

kiran

Dear All,

A B C D E
Date Time Date Time Output
04.07.08 9:18:56 AM 01.08.08 7:41:33 PM
04.08.08 9:18:56 PM 01.08.08 7:41:33 PM
24.08.08 10:05:03 AM 22.08.08 12:13:30 PM

Check date time in column A, B, C & D if date & time of column C & D is
greater that date time of column A & B I should get "No" else "Yes" in column
E.

TIA
 
R

RyanH

This should work for you. This macro will run down rows 2 thru last row in
Col.A

Option Explicit

Sub TestDates()

Dim i As Long

For i = 2 To Cells(Rows.Count, "A").End(xlUp).Row
If (Cells(i, "A").Value And Cells(i, "B").Value) < _
(Cells(i, "C").Value And Cells(i, "D").Value) Then
Cells(i, "E").Value = "Yes"
Else
Cells(i, "E").Value = "No"
End If
Next i

End Sub

Hope this helps! If so, please click "YES" below.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top