How to find unique rows comparing two excel files?

I have two excel files - excel1 and excel2.
Both excel files contain Serial Number column and they don’t contain same number of rows.(excel1 contains more rows than excel2).
Also, there are more than 15.000 rows in both files.

What I need to do is to compare those two excel files and to get values from Serial Number column that exist in excel1 but don’t exist in excel2.

Thanks in advance. :raised_hands:

@bp777

Check below for your reference

Hope this may help you

Thanks

1 Like

Hi @bp777

Please try this,

dt1 - excel sheet1 data
dt2 - excel sheet2 data

Query to find common rows,

dt1.defaultview.totable(false,“Serial Number”).asenumerable.intersect(dt2.defaultview.totable(false,“Serial Number”).asenumerable,system.data.datarowcomparer.default).copytodatatable

Query to find uncommon rows,

dt1.defaultview.totable(false,“Serial Number”).asenumerable.except(dt2.defaultview.totable(false,“Serial Number”).asenumerable,system.data.datarowcomparer.default).copytodatatable

Use write range and write the data back into the excel to check the values.

Thanks

1 Like

Great method. Thank you!

@Srini84 thank you for your help as well. :raised_hands:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.