I wrote a code as follows to compare 2 tables on diff worksheet.
Each work sheet has about 6000 Rows.
The code works but appears to Work very slow.
Is there a more efficient way to do it.
...
You might be better off using one of Excel's built-in lookup functions to populate the Tag column. For example, I recreated your two tables from the data shown in your post, but in TABLE2 I reversed the order of the two columns. Then I used this formula in cell C2 of TABLE1, I placed this formula
=VLOOKUP(B2,TABLE2!$A$2:$B$5,2,FALSE). I copied this cell and pasted it down the rest of the column, and this is the result...
-
LABEL ID1 TAG
-
ABA001_X1 1 ABA001_1
-
ABA001_X2 1 ABA001_1
-
ABA001_X3 2 ABA001_2
-
ABA001_X4 1 ABA001_1
-
ABA001_X5 1 ABA001_1
-
ABA001_X6 2 ABA001_2
-
ABA002_X1 3 ABA002_1
-
ABA002_X2 4 ABA002_2
(edited slightly for formatting here)