How to Compare Date for Excel also format is having issue

Hi All,

I am new to Uipath, i was trying to compare date from 2 sheet so first sheet has datetime format of below

Ceased_Date
13/1/2020 11:48
13/1/2020 11:48
13/1/2020 11:48
13/1/2020 11:48
13/1/2020 11:48
13/1/2020 11:48
13/1/2020 11:48
9/1/2020 13:48
9/1/2020 13:48
9/1/2020 13:48
9/1/2020 13:48
9/1/2020 13:48
9/1/2020 13:48
9/1/2020 13:48

2nd Sheet has datetime as below format

ORDERCLOSEDDATE
15/1/2020 11:30
15/1/2020 11:30
15/1/2020 11:30
15/1/2020 17:46
28/1/2020 11:52
28/1/2020 11:52
14/1/2020 14:43
6/1/2020 13:34
6/1/2020 13:34
6/1/2020 13:34
6/1/2020 14:52

So i need set a few condition as below

IF Ceased_Date > ORDERCLOSEDATE = YES
eg.(Cease Date = 13/1/2020 11:48 > ORDERCLOSEDATE=9/1/2020 13:48) = Yes
IF Ceased_Date MONTH = ORDERCLOSEDATE MONTH = YES
eg.(Cease Date = 13/1/2020 11:48 Month = 01 = ORDERCLOSEDATE=9/1/2020 13:48 Month = 01) = Yes

It will update a brand new column

How can i do this thanks advance for the help

Regards

@beyondx Can you Check how the Date Value appears in Message Box after Reading the Excel File ?

Hi Superman, the date value appear as

image

@beyondx Are there any other Columns to be matched in two Sheets other than CeasedDate and OrderClosedDate?

We cannot Directly Compare A Column from One Sheet to another there needs to be a Link between the rows of two sheets, either an ID Column or Name :sweat_smile:

@supermanPunch Hi Superman yes there a unique key column to match

@beyondx Then Considering you’re already Checking if Unique key matches, you can Perform this Check next:

Datetime.ParseExact(row(“Ceased_Date”).ToString,“MM/dd/yyyy HH:mm:ss”,System.Globalization.CultureInfo.InvariantCulture) > Datetime.ParseExact(row("ORDERCLOSEDATE ").ToString,“MM/dd/yyyy HH:mm:ss”,System.Globalization.CultureInfo.InvariantCulture)

and

Datetime.ParseExact(row(“Ceased_Date”).ToString,“MM/dd/yyyy HH:mm:ss”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM”).Equals(Datetime.ParseExact(row("ORDERCLOSEDATE ").ToString,“MM/dd/yyyy HH:mm:ss”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM”)

1 Like

Hi @supermanPunch i have tried and the code works thanks alot for the help

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.