0
votes

I'm new to excel. I'd like to merge two sheets matching by the column variables. For example, I'd like to merge these 2 sheets by "Site":

Sheet 1         
Site | Time         
 1   |   1           
 1   |   2           
 2   |   1             
 2   |   2             
 2   |   3             
....

Sheet 2
Site | Location
 1   |    a
 2   |    b
 3   |    c
 4   |    d
 5   |    e
....    

Desired:

Site | Time | Location
 1   |  1   |    a
 1   |  2   |    a
 1   |  3   |    a
 2   |  1   |    b
 2   |  2   |    b
 2   |  3   |    b
...

I've tried VLookup, index, match, and the ablebit add-in, but nothing seems to give the desired results.

Any suggestions? I'm new to excel so I'd be extremely grateful for as much detail you can provide. Thank you!

1
Show us your current code. - PKatona
how should it know to output 1 | 3 | a? where come that from? - Dirk Reichel

1 Answers

0
votes

You were on the right track with vlookup.

On your "sheet1" in column C, try this:

=VLOOKUP(A2,Sheet2!$A$2:$B$6,2)

(Where B6 is the end of your data) You can then expand that equation all the way down.