Home » excel » lookup tables – Data matching in Excel

lookup tables – Data matching in Excel

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have two separate Excel files containing an old and a new electrical plant register, both containing electrical plant records identified by the same asset number.

The first file is our old asset register containing an old asset number and a full description of what the plant is. The second file is the new asset register. In some cases the people who made our new asset register put a meaningful description for what the piece of plant is, but when they saw our old asset number on some pieces of plant they just used that as the description.

What I need to do is pull from the old file the description of any records in the new file where the description = the asset number of that piece of plant in the old file.

I.e.

if (current_cell_value exists in old register)
  {pull description of that item from old register and store in corresponding cell in new register;}

Old file looks like this:

5538 PC
2398 Monitor

New file looks like this:

1449449 Office  IEC LEAD
1449450 Office  MONITOR
1449451 Office  5538
1449452 Office  2398
1449453 Office  IEC LEAD

Ultimately I want new file to look like this:

1449449 Office  IEC LEAD
1449450 Office  MONITOR
1449451 Office  PC
1449452 Office  MONITOR
1449453 Office  IEC LEAD

How would I do this?

How to&Answers:

Assuming you can copy the old asset table columns A and B into an empty sheet in your new workbook, let’s put them on a sheet named “OLD”, again in columns A and B.

Now assume your new dataset is columns A, B and C and it is column C where you need to change “some” of the values.

In an empty column, let’s say D2, put this formula and copy down:

=IF(ISNUMBER(MATCH(C2, Old!$A:$A, 0)), VLOOKUP(C2, Old!$A:$B, 2, 0), C2)

Now you have a new set of values and hopefully all the numerics matched and now display the old register description.

Highlight the new column of values and COPY them.
Click on the original set of values in column C and do an Edit > Paste Special > Values

Now, clear the column D and you’re done.

NOTE: If you’re using Excel 2007+ then you can use a simpler formula than above, you can use this:

=IFERROR(VLOOKUP(C2, Old!$A:$B, 2, 0), C2)