How to delete duplicate rows in Excel

Hi Everyone. I need to delete duplicate rows in excel. But in that duplicate rows i need to keep one row.For example, in one column 3 more duplicate values is there. Capture

1 Like

@Buvaneshwaran_R Have you tried Remove Duplicate rows Activity ? In the Screenshot I don’t think there are Proper Duplicates present. Is the duplicates based on a Column Value ?

Hi @Buvaneshwaran_R,

Check this one.

Here is the video demonstration .

Thank you
Balamurugan.S

@supermanPunch in that excel a column INVOICE124 it’s duplicate only if it is duplicate i want to first one keep it as same value in excel. Second duplicate i need to change the value for example

   A                        B

INVOICE124 bbb
INVOICE124 0

I need this output. Second duplicate i want to replace the value name as 0

Hi @Buvaneshwaran_R

You could do it by using by using the following code:
DataTable distinctTable = dtRows.DefaultView.ToTable(true, "column1");

For example
image
Hope this helps!

DataTable FilterDt= MainDataTable.DefaultView.ToTable(true,“Company Name”,“Date”)

or use Remove Duplicate Rows Activity

MainDT.AsEnumerable().GroupBy(Function(a) a.Field(Of String)(“Company Name”)).Select(Function(b) b.First).CopyToDataTable() - This is for finding only unique company

Thanks
Latika

@Buvaneshwaran_R Check this Workflow :

I have made it work by keeping only two of the Duplicates if any using a Linq Query and then Update the Value for the Second Duplicate using a For Each Row. I think this is the Output that you were expecting. If it doesn’t match your required Output, please explain a bit more in detail.

Check the Input File. Execute the workflow. It should generate an Output Sheet in the same Excel. Revert back if it doesn’t work.

RemoveProcessedDuplicates.zip (8.4 KB)

@supermanPunch I checked your zip file. Mean while 3 duplicate rows is there 3rd it’s automatically deleted. can you check once i have 2 more duplicates it’s there. Can you help me to solve this issue

@Buvaneshwaran_R Don’t you need to keep only two Duplicates (including the original one) and Update the Second Duplicate ?

@supermanPunch in that your zip file. I have 4 duplicate values is there it will be automatically deleting 2 rows.

@supermanPunch I have more than 5 duplicates is there same invoice #

can you check and resolve this issue. can you help me

@Buvaneshwaran_R Can you give me the Input data where you are facing this issue and the Output that you are expecting? It will help faster to understand and solve it.

@supermanPunch canyou check this excel. There is 4 duplicate row is thereInput.xlsx (9.4 KB)
I need to keep 1 row same other 3 i need to change as 0

@Buvaneshwaran_R Ohh, So you want to keep all the duplicates as well and just update all duplicates to 0 keeping only one original value :sweat_smile:

@supermanPunch Yeah Correct. Like that i need can you help me

1 Like

@Buvaneshwaran_R Considering the data in the ‘Invoice#’ column will always be in that format. The workflow below should be able to give you the right output.
Check this workflow :
RemoveProcessedDuplicates.zip (9.5 KB)

@supermanPunch Thanks bro it’s working fine. Thanks for your help.

1 Like

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