Searching values and arranging rows in Excel

have a look here on how to deal with all columns without explicit definition of compare rows:

sometimes GroupBy can be helpfully and in a merged datatble the different datatable sources can be marked in an extra column

However I would suggest to work out a sample data set more representing the complexity of your case. Then the options for the solution approach can be cross checked and evaluated