'How to get values with a for loop that checks another table's values?

This is pretty complicated so I didn't know how to make a title for this.

The following two tables are just examples of what I have. Table A has data that I want to be drawn in to Table B. So I'm trying to create a for loop and give wherever there is 'alex' in table B the values found in table A.

enter image description here

The values should be in the order they appear in the table A.

So I want Table B to become as such:

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source