Data table column compare

I am having two data tables,
DT1 -
image

DT2 -
image

here there are differences found on ‘Activityname’ column.
I need a solution which compares both data table and wherever the DT2 country name is different than DT1, I want to replace the ‘Activityname’ of DT2 with DT1 ‘Activityname’.

Note: DT2 has more no of rows than DT1.

Expected solution - DT2 :
image

Thanks in Advance

Hey @Jnanesh_Ballal ,
If your Inputs are having less data then you can use below method .

ColumnCompare.zip (2.3 KB)
ColumnCompare.xlsx (9.5 KB)

Output :
image

Regards,

1 Like

@Jithesh_R ,
Thanks for the solution, but the DT2 has more number of rows than DT1 so we cannot compare directly through rows. Is there any ways to implement this solution in linq.

Thanks

Hi

Check this

ColumnCompare.xaml (12.3 KB)


Dt1.AsEnumerable.Where(function(row) row(0).ToString.trim = s(0).ToString.trim AndAlso row(1).ToString.trim = s(1).ToString.Trim AndAlso row(3).ToString.Trim =s(3).ToString.Trim).Select (Function(a) a(2).tostring).ToArray

ColumnCompare.xlsx (10.8 KB)
Hope this helps

1 Like

Requirement description differs from Output sample e.g 103 australia