Hi @Gaurav_Gore ,
We could perform Grouping of the rows based on the 4 columns as per the condition mentioned, and then we can capture the rows whose grouped Count is greater than 1 (2 or more), which would capture your required result.
Try the below :
-
Assuming, Excel sheet is already read as a Datatable, say
DTusingRead Rangeactivity. -
Next, we can create a Output Datatable by making a Clone of the Input DT like below :
OutputDT = DT.Clone
- Next, we can perform the Groupby and Filter only the Row Groups having count more than 1 (Duplicates).
OutputDT = DT.AsEnumerable.GroupBy(Function(x)New With{key .a=x("ID").ToString,key .c=x("R1"),key .d=x("R2")}).Where(Function(x)x.Count>1).SelectMany(Function(x)x).CopyToDatatable
- Next, you could write the
OutputDTto an Excel sheet usingWrite Rangeactivity.
Implementation :
For more on Linq Groupings :
Also, If there are no rows as Duplicates, you would need to handle it using the below method :
