Excel Automation for duplicate items need to sum in other columns

Hi,
I have a excel contains 14 Columns. I that in Description Columns i have duplicates for the duplicates i need to add sum in “Functional Amount” remove the duplicates. and finally need to print the full data table with all columns. Anyone can you please help me on this, It’s Really help to me,

Thanks,
NandaKishore

Hi @nanda_kishore !

you can find the unique values by invoking the following LINQ expression:

var_InputFile.AsEnumerable.Select(Function(a) a("Description").ToString).Distinct.ToList().Where(Function(b) Not String.IsNullOrWhiteSpace(b)).ToArray

this will retunr a list of all the values, without the duplicates. Since then you want to identify of those, the ones that are repeated, what you can do is apply a ForEach Unique Description, and if it has more than 1 match on the original DT, you then know that the result is a duplicated row.


image

Just for demo purposes, on the example attached, the duplicated values are saved in a list of strings, so then you can Lookup Them on the DT (With the “Lookup Data Table” activity), and delete that row from the original DT. ending with a clean DataTable.

DuplicateRowsCount.zip (44.6 KB)

Hope it helps!

Best Regards,
Ignasi