Removing duplicates and getting the value

Hi all
I have excel with 3 column. I have to check second column value if they are repeating. If they are repeating, we should check the 3rd column which consists of integers. If two of the 2nd column cells are repeating, we should check the 3rd column cells for the values and compare the two values and take which one is maximum.and delete the other dupilcate.
For example
Column1 column2 column3
Arun 25d 10
Bala 25d 20

In the above case, 1st to be deleted and I have the name bala as result .
Here column 2 is same, max of column 3 should be taken.
Thanks in advance

Hi @Newton_Rich_SV

Check this post

dt.AsEnumerable().GroupBy(Function(i) i.Field(Of String)(“Column2”)).Select(Function(g) g.First).CopyToDataTable()


1 Like

Hi ashwin
When I implement this code. It is telling that column2 is not available in the table as i don’t have headers in the column. Please suggest.

Hi @Newton_Rich_SV

Is the property addheaders been checked for readrange


No ashwin it is unchecked

Hi @Newton_Rich_SV
hope you have the datatable ready with a variable named outdt
–use a assign activity like this
out_value= (from r in outdt
group r by r(1) into g
select g.OrderByDescending(x => x(2))

Cheers @Newton_Rich_SV