Merge the values of different rows & columns in datatable

I want to remove duplicate entries from data table & work with only unique rows after that i want to merge Name code & Number in a single cell for each Name Column. Please find below the Input and Output required.

image

Hi @Yoichi ,
Any help from your end would be appreciated.

Hi,

Hope the following helps you.

dtResult = dt.AsEnumerable.GroupBy(Function(r) r("Name").ToString).Select(Function(g) dt.Clone.LoadDataRow({String.Join(vbLf,g.Select(function(r) r("Name Code").ToString+"-"+r("Number").ToString).Distinct),g.key,g.First.Item("Number").ToString},False)).CopyToDataTable

Sample20211019-4.zip (8.9 KB)

Regards,

Hi @Yochi,
Thank you …
The code is merging the data correctly but before merging I also wanted to remove duplicate values based on Name Code. Can you please help …

Regards…

Hi,

Can you share your expected result as screenshot or file etc?

Regards,