Search code examples
excelopenoffice.org

Merge two csv files based on common column


I have two csv files with data, which contains one common column with the same data (ex. product P/N that is unique).

How to merge all data into one spreadsheet?

File one

P/N | Name        | Quantity
xxx | Product xxx | 3
zzz | Product zzz | 6
yyy | Product yyy | 0

File two

P/N | Image
zzz | Image URL zzz
xxx | Image URL xxx
yyy | Image URL yyy

What i want?

P/N | Name        | Quantity | Image 
xxx | Product xxx | 3        | Image URL xxx
zzz | Product zzz | 6        | Image URL zzz
yyy | Product yyy | 0        | Image URL yyy

Solution

  • My approach would be to use VLOOKUP on the P/N in file one and grab the data from file two.

    VLOOKUP(p/n,filetwotable,2,0)
    

    drag this down to the bottom of column D, modify the third parameter (2) for the next two columns in columns E and F.

    I would copy/paste special values to kill the formulas.

    I do this often; I create a template then drop the data into it.

    Good luck!