Excel Formula or VBA to find cell contains a certain text

sprimax

New Member
Joined
Oct 3, 2008
Messages
41
Hi Folks,

Let's say I have these words in Column A (A1:A4)
Green Apple
Red Apple
Yellow Banana Cute
Green Banana

How is the code or formula be written if I want to get Apple & Banana return in B1:B4?
B1 = Apple
B2 = Apple
B3 = Banana
B4 = Banana

Thanks so much
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Are Apple and Banana going to be your only choices and will they ever both occur? Will there be times where neither occur?
 
Upvote 0
Dear Murrayty,

This is the fact, I have more than 7 criteria to find in column O (15), they are :
Partial
Surplus
Discrepancy
Waiting Memo
Waiting Physical
Inventory On Progress
Prepare Physical Summary

Thanks
 
Upvote 0
Dear Murrayty,

These are the actual sentences in the column
- Partial Close Out (desired return = Partial)
- Waiting Memo Close Out (desired return = Waiting Memo)
- Material Surplus (desired return = Material Surplus)
- Material Surplus & Outstanding Warehouse (desired return = Material Surplus)
- Discrepancy between material installed (desired return = Discrepancy)
- Prepare Discrepancy (desired return = Discrepancy)
- Waiting Physical Inventory (desired return = Waiting Physical)
- Prepare Summary (desired return = Prepare Summary)

Thank you
 
Upvote 0
I would just make a lookup table on another sheet and call to it.

=VLOOKUP(A1,Sheet2!$A$1:$B$8,2,FALSE)

A1 = The cell you want to lookup

Sheet2 A1:B8 =

Code:
Discrepancy between material installed	        Discrepancy
Material Surplus	                        Material Surplus
Material Surplus & Outstanding Warehouse	Material Surplus
Partial Close Out	                        Partial
Prepare Discrepancy	                        Discrepancy
Prepare Summary	                                Prepare Summary
Waiting Memo Close Out	                        Waiting Memo
Waiting Physical Inventory	                Waiting Physical

It might be possible to write a formula to do it but I am not having any luck myself.
 
Upvote 0
Dear Murrayty,

Thanks for your time. I will take the option if I can't get another formula or VBA code.

Again. thank you very much
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,443
Members
448,898
Latest member
drewmorgan128

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