Remove duplicates in excel using time

I want to remove the duplicates in this excel by using the time column, If duplicates found in the Policy column i want to keep the recent one only & need to remove the old one using time. How to do this ??
Attached the screenshot & Excel File

RemoveDuplicateUsingTime.xlsx (8.9 KB)

Hey @Praveen_Vs ,
To do this you can follow these steps.
1.Initially Read your Input Using "Read range workbook " activity
2. Sort the input datatable in descending order (Using “Time” Column)
3. Now all the recent timings will come first .
4. Then you can group the data By taking the first value(That is ignoring the duplicate values)

Please find the attached workflow
RemoveDuplicateUsingTime.zip (1.7 KB)

Output:
image

Regards,

2 Likes

Hi @Praveen_Vs ,

-Keep preserve formatting true while reading the Excel

Try the following:

(From row In dt.AsEnumerable() Group By policy = row("Policy").ToString() Into policyGroup = Group Let latestEntry = policyGroup.OrderByDescending(Function(r) DateTime.Parse(r("Time").ToString())).FirstOrDefault() Select latestEntry).OrderBy(Function(r) DateTime.Parse(r("Time").ToString())).CopyToDataTable()

Regards,

2 Likes

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