need to look for text in cell in column and then return a phrase in a new cell vba or if

damsel123

New Member
Joined
Jul 3, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
look for 1) 3 clr,4 clr ,5 clr, 6 clr return 3-6 F
2) 8 clr,10 clr ,12 clr, return 8 -12 f
if not found return value in not found col
Descriptionnot found
5 Clr GAM 4221 x 6452
4 Clr XYZ 1234 X 4561
6 Clr XYZ 9843 X 5678
10 Clr XYZ 4433 X 2211
12 Clr XYZ 7777 X 9999
4 Livingroom Clr 9876 x 5656Bin a
5 Livingroom Clr 8876 x 6656bin b
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi @damsel123
Welcome to the MrExcel forum. Please accept my warmest greetings and sincere hope that all is well.

I recommend you put in a table the texts you want to search for and the phrase you want as a result. In my example, I put the table in columns G and H.

Review the following example to see if it meets what you need.
Dante Amor
ABCDEFGH
1Descriptionnot foundtextphrase
25 Clr GAM 4221 x 6452return 3-6 F3 clrreturn 3-6 F
34 Clr XYZ 1234 X 4561return 3-6 F4 clrreturn 3-6 F
46 Clr XYZ 9843 X 5678return 3-6 F5 clrreturn 3-6 F
510 Clr XYZ 4433 X 2211return 8 -12 f6 clrreturn 3-6 F
612 Clr XYZ 7777 X 9999return 8 -12 f8 clrreturn 8 -12 f
74 Livingroom Clr 9876 x 5656return 3-6 F10 clrreturn 8 -12 f
85 Livingroom Clr 8876 x 6656return 3-6 F12 clrreturn 8 -12 f
9XYZ 7777 X 9999not found
107 Clr XYZ 7777 X 9999not found
Hoja3
Cell Formulas
RangeFormula
B2:B10B2=IFERROR(LOOKUP(2,1/ISNUMBER(SEARCH(SUBSTITUTE($G$2:$G$8," ","*"),A2)),$H$2:$H$8), "not found")


---------------------

Also try the following formula
Dante Amor
ABCDEFGH
1Descriptionnot foundtextphrase
25 Clr GAM 4221 x 6452return 3-6 F3 clrreturn 3-6 F
34 Clr XYZ 1234 X 4561return 3-6 F4 clrreturn 3-6 F
46 Clr XYZ 9843 X 5678return 3-6 F5 clrreturn 3-6 F
510 Clr XYZ 4433 X 2211return 8 -12 f6 clrreturn 3-6 F
612 Clr XYZ 7777 X 9999return 8 -12 f8 clrreturn 8 -12 f
74 Livingroom Clr 9876 x 5656not found10 clrreturn 8 -12 f
85 Livingroom Clr 8876 x 6656not found12 clrreturn 8 -12 f
9XYZ 7777 X 9999not found
107 Clr XYZ 7777 X 9999not found
Hoja3
Cell Formulas
RangeFormula
B2:B10B2=IFERROR(LOOKUP(2,1/ISNUMBER(SEARCH($G$2:$G$8,A2)),$H$2:$H$8), "not found")





--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------​
 
Upvote 0

Forum statistics

Threads
1,217,346
Messages
6,136,042
Members
449,981
Latest member
kjd513

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