I have a data table consisting of two columns: “Name” and “Attendance.” For example:
this table may contain duplicate names.
In this case, I need to filter the table so that if duplicate entries are found, only the one marked as “Present” is kept. Additionally, it is important to retain all other related data.
(From d In dtTest.AsEnumerable
Group d By d("Name").ToString.Trim.ToLower Into grp = Group
From r In grp Where r("Attendance").ToString.Trim.ToLower <> "absent"
Select r
).CopyToDataTable
Obviously, if you have the data in an Excel file read that into a datatable instead of building one.