# Compare 2 columns in Excel and copy data from 3rd column

I'm trying to compare 2 columns that don't have the same size (one has 205 entries, the other 440) and if the data from column B matches the data in column A, the data from column C must be copied in column D at the same level of the entry that matched in column A. How can I do this?

Please let me know if you need more info. I don't know how to copy part of the sheet in order for you to get an exact idea of what I'm talking about.

Stefan

• Which column has 205 and which has 440? – mcalex Jul 23 '14 at 8:09

Sounds like a Lookup problem

Assuming Column A is the column with 205 entries and your data has headers:

in Cell D2 use a vlookup formula:

``````= VLOOKUP(A2, \$B\$2:\$C\$440, 2, FALSE)
``````

Copy down this formula to D205

et voila

• It partially worked. I get some answers but most of them are #N/A. In column A I have IDs of employees (205 of them), in column B I have 440 IDs (205 that are in column A + extra) and in column C I have the names of the 205 from column A. I want to associate their names with the IDs from column B in column D. – Stefan Jul 23 '14 at 11:14
• Oops. Need to Absolute Reference the array. Ie, change the middle argument to the vlookup function in cell D2 to: \$B\$2:\$C\$440 Then copy/down again. Changed in answer. – mcalex Jul 23 '14 at 14:02

I hope you need to find out the duplicate records from Column A to Column B.
Pivot table is a better option for find a duplicate records Microsoft Excel.
Select the whole data(Column A and Column B) select Insert tab -> Pivot Table.
Select the column A and Column B in Row format, all the duplicate entries are filtered by itself.

## protected by Community♦Nov 7 '15 at 16:30

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).