Google-sheets – If a name matches a name in another sheet, then print the cell next to it

google sheets

If sheet 1 has company names (and duplicates of those names)

company A
company B
company A
company A

the other sheet has all those company names and their URLs (no duplicates)

company A - url
company B - url
company C - url

Is there a formula to allow Sheet 1 to look at sheet 2, and if there is a match to return the corresponding url next to the name?

Best Answer

Yes, this is what VLOOKUP does: it looks up an entry in a given range, in vertical direction. For example,

=VLOOKUP(A2, Sheet2!A2:B, 2, FALSE)

would be a formula for the second row in Sheet1: it searches column A of the second sheet for whatever name is in A2, and returns the corresponding value in B column of Sheet2.

If some names appear more than once in Sheet1, you'll get the URLs more than once, too.

It looks like you're okay with duplication in Sheet1, but just in case, I'll point out the command UNIQUE which distills a given range to unique values in it.