@Hisuhong
find attached sample seperating the Duplicates and NonDuplicates and writes out into 2 different Worksheets
Hisuhong.xaml (10.0 KB)
Result for Reference: Result.xlsx (9.1 KB)
the main Ideas were to Identify the Duplicates / NonDuplicates on its occurence validating the 4 columns
this was solved with using the Keys for a GroupBy and Count
E.g. NonDuplicates:
(From r In dtOrigin.AsEnumerable()
Select C1 = r(0).ToString.Trim, C2 = r(1).ToString.Trim, C3 = r(2).ToString.Trim, C4 = r(3).ToString.Trim
Group By C1, C2, C3, C4 Into Group
Select C1, C2, C3, C4, Count = Group.Count
Where Count = 1
Select New String() {C1,C2, C3, C4}).ToList
Then Rows were retrieved based on this Key Information
this was Solved with a Join Statement
E.g. Duplicates:
(From k In DupKeys
Join r In dtOrigin
On k.ElementAt(0) Equals r(0).toString And k.ElementAt(1) Equals r(1).toString And k.ElementAt(2) Equals r(2).toString And k.ElementAt(3) Equals r(3).toString
Select r).CopyToDataTable
Kindly Note: there would be several options to solve it as well. Let us know any open Questions