Remove older duplicates

Dear RPA developers,

I am very new to RPA and I am having some trouble issues regarding Duplicates.
Imagine this list I imported from an excel file to a DataTable. This list has many columns, each with different information. As an example I’ll mention column A and column D. Column A has the names of the projects, while column D has the dates of the projects. The problem is that there are several projects with the same name and different dates.
What I want is, in case there are projects with the same name, to keep the one with the most recent date and eliminate the oldest ones.

I hope you guys can help me =D

Hi
welcome to uipath community
–use EXCEL APPLICATION SCOPE and pass the file path of excel as input and inside the scope use READ RANGE activity and get the output with a variable of type datatable named dt
–first lets sort the column based on Project dates with SORT DATATABLE ACTIVITY
–then we can use a assign activity like this
dt = dt.AsEnumerable().Groupby(Function(a) a.Field(of string)(“yourcolumnname”).ToString).Select(Function(x) x.First()).CopyToDatatable()

Cheers @Asghany

2 Likes

@Palaniyappan Thank you very much for your answer

Can you please explain me the formula? Which part of the formula relates to the Projects names? Which part is about the project dates?
Sorry for all this Rookie questions

this is done by

and

this is done by

where replace the yourcolumnname with Project Names as columnname between double quotes

Cheers @Asghany

@Palaniyappan The formula almost solved the problem. However, there was one factor that I did not mention. There are projects that have the same code, even though they have different names.
The previous formula will result in there being only one code regardless of the name. I would like the program to keep a code for each name and in case. And in case there are several identical codes in the same name only the most recent one should be kept.

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