ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date Diff Help (https://www.excelbanter.com/excel-programming/417529-date-diff-help.html)

kiran

Date Diff Help
 
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

RyanH

Date Diff Help
 
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.
--
Cheers,
Ryan


"kiran" wrote:

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



All times are GMT +1. The time now is 02:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com