Comparing 2 Excel Files for Exact Match Only

Hello,

I need a way to compare two Excel files to see if they are exactly the same. I don’t need to find which rows are different, create new tables with the differences, do any joins, unions or anything like that. I just need a true/false answer: is sheet 1 exactly the same as sheet 2?

The column names are the same, in the same order, and all the other values match. Basically, if I email sheet 1 to person A and sheet 2 to person B, they should be looking at the exact same thing. Is there a way to do that?

Thanks

Hello @Ken_Ward

You can use the below linq to find the matched records. Then find the number of rows as MatchedDT.Rows.Count.

Else watch the below video and get the disimilar datatable. Then use unmatched.Rows.Count>0. If yes, both sheets are not equal, else equal.

MatchedDT (DataTable) = Dt1.AsEnumerable().Where(Function(row) Dt2.AsEnumerable().
Select(Function(r) (r.Field(Of String)(0)).Trim).Any(Function(x) x = (row.Field(Of String)(0)).Trim)).
CopyToDataTable()