Home » excel » vba – Excel – matching cell values in two columns, if match copy another value to blank cell

vba – Excel – matching cell values in two columns, if match copy another value to blank cell

Posted by: admin April 23, 2020 Leave a comment

Questions:

I’m trying to get my hands on a solution that will help me to compare each of the values of the cells in column A and D, and if there is a match add the value from column B to respective cell in column E.

Example

I’ve tried some Index(match)-functions but I can’t really get it to work.

Any ideas? Really appreciate it!

Best regards

How to&Answers:

VLOOKUP() Solution

In cell E1 =IFERROR(VLOOKUP(D1, A:B, 2, 0),"No Match") and drop equation down as needed.


INDEX(MATCH()) Solution

In cell E1 =INDEX($B$1:$B$6,MATCH(D1,$A$1:$A$6,0)) and drop equation down as needed.


The VLOOKUP us using the entire column as the lookup range, although it will stop calculating once the first match is found. If your data is constantly expanding, this will always include the data range. The INDEX(MATCH) is using a locked cell reference. So, if the data expands to more rows, the equation will need to be altered (manually or by some other means like Named Range or OFFSET). You can easily make either solution search entire columns or use locked cell references.