I would create a new ID which is unique, and incorporates the order of the appearance of the IDs. One way to do that would if the first excel starts in A1, so A1 = 'id', then enter in E2:
=A2+COUNTIF($A$2:A2,A2)/10000
Choose the divisor (10000 in this case) so that it is larger than the expected number of duplicates.
Do the same for both tables, and then you can use these unique IDs to join the tables using VLOOKUP
, INDEX/MATCH
, etc.
IFERROR
can be used to return ""
instead of #N/A
for missing rows.