Mayur Dighe
Mayur Dighe

Reputation: 419

Google Sheets - Search column value in another column if found copy second column's value

I have a situation like below: Column A has some values. Column B has more values. Now I want to check if Column B contains values from Column A. If it contains then print values from Column B to Column C. Please note that all values are unique so no confusion of finding value more than once.

Column A
john.doe
alice.white

Column B
[email protected].
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

Column C(This is expected output)
[email protected]
[email protected]

Upvotes: 1

Views: 75

Answers (1)

JPV
JPV

Reputation: 27292

Here's one way ..

=filter(B2:B, match(regexextract(B2:B, "(.*)@"), A2:A, 0))

enter image description here

Or maybe

=ArrayFormula(if(len(A2:A), vlookup(A2:A, {split(B2:B, "@"), B2:B}, 3, 0),))

Upvotes: 2

Related Questions