Search a cell for a list of values contained in another column and return that value if found

khan123

New Member
Joined
Feb 2, 2022
Messages
4
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
  2. MacOS
So I want search a cell for a list of values and return that value if value is found.

E.g
A
----
I love mangoes
I like mangoes
I hate bananas
I love oranges

B
-----
mangoes
oranges
bananas

I want to search the value in 'A' column where I looked for column 'B' values for each cell. If that value is found, I populate the next column with that value. In the given example, the desired result would be

I love mangoes -> mangoes
I like mangoes -> mangoes
I hate bananas -> bananas
I love oranges -> oranges
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi,

Like this:

Book3.xlsx
AB
1I love mangoesmangoes
2I like mangoesmangoes
3I hate bananasbananas
4I love orangesoranges
5
6
7
8mangoes
9oranges
10bananas
Sheet974
Cell Formulas
RangeFormula
B1:B4B1=LOOKUP(2,1/SEARCH(A$8:A$10,A1),A$8:A$10)
 
Upvote 0
Solution
Perfect, thank you! I am still exploring this syntax, how this is working.
 
Upvote 0
You're welcome, thanks for the feedback.

If in case you may have text strings that has no match in the list (like A5), just wrap my formula with IFERROR to show Blank rather than an error:

Book3.xlsx
AB
1I love mangoesmangoes
2I like mangoesmangoes
3I hate bananasbananas
4I love orangesoranges
5I like hamburgers 
6
7
8mangoes
9oranges
10bananas
Sheet974
Cell Formulas
RangeFormula
B1:B5B1=IFERROR(LOOKUP(2,1/SEARCH(A$8:A$10,A1),A$8:A$10),"")
 
Upvote 0
This is awesome, I needed that. If the match is not found, I want to show the original cell content, which I think I should be able to do. I would have never been able to solve this!
 
Upvote 0
This is awesome, I needed that. If the match is not found, I want to show the original cell content, which I think I should be able to do. I would have never been able to solve this!

Yes, just replace the "" at the end of the formula with the subject cell:

Book3.xlsx
AB
1I love mangoesmangoes
2I like mangoesmangoes
3I hate bananasbananas
4I love orangesoranges
5I like hamburgersI like hamburgers
6
7
8mangoes
9oranges
10bananas
Sheet974
Cell Formulas
RangeFormula
B1:B5B1=IFERROR(LOOKUP(2,1/SEARCH(A$8:A$10,A1),A$8:A$10),A1)
 
Upvote 0
Perfect, solved my really complicated problem!
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,581
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top