Remove duplicates from Excel based on single column

Hi Team,

Below is the input file

input.xlsx (10.1 KB)

From the above input file i need to remove duplicates from column 1(MAIN_FORM_REQUEST_ID)

Please help me with solution

Thanks in advance

Does Excel Remove Duplicated Command not working?

Hi @vinjam_likitha

If there is duplicate value in column 1, how u want the remaining column data.

Which row u want in the output.

Can u share sample output file?

Based on your requirement use this query.
dt_input=dt_input.AsEnumerable.GroupBy(Function(x) x(“MAIN_FORM_REQUEST_ID”).ToString).Select(Function(y) y.LastOrDefault).copyToDataTable()

dt_input=dt_input.AsEnumerable.GroupBy(Function(x) x(“MAIN_FORM_REQUEST_ID”).ToString).Select(Function(y) y.FirstOrDefault).copyToDataTable()

Hii @vinjam_likitha
Try this one,

From row In DT_Input.AsEnumerable
Group row By a=row(“MAIN_FORM_REQUEST_ID”).ToString.Trim Into
Select grp.First

Using Group function This might help .

Hello you can use group by method from linq
and try this

Function(p) p.Columname).CopyToDataTable


I was not considering other column data only i want
first cloumn data in the output file by removing duplicates.


Hi @vinjam_likitha
Try this query.
dt_input= dt_input.DefaultView.ToTable(True,“MAIN_FORM_REQUEST_ID”)

1 Like


Thanks @Suraj_B_Shetty for the solution

Thanks @MuralidharVankamaddi @Jithesh_R @pawanrajpurohit

@vinjam_likitha ,

Take a look at this XAML.
Remove_Duplicate_Rows.xaml (5.9 KB)

Done exactly as you wanted !

Thanks @arjunvyshnav

1 Like

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