when
then
(From d In dtData.AsEnumerable
Group d By k=d("UnitCost").toString.ToUpper.Trim Into grp=Group
Where grp.Count > 1
Select g = grp.Last()).CopyToDataTable
So it will group the data on CostUnit
we will have Duplicates when the group member count > 1
so we filter for only these groups
and take from the group last member
For example lines 3,5,7,9,11.