Search for multiple characters in a single cell

Knob12

New Member
Joined
Jun 30, 2015
Messages
2
I have a formula that I will enter into a cell and drag down to about 6,000 rows. I need get the value in column C of each row, up to a colon, dash, the word "FOR" (upper or lowercase), whichever comes first. Then, I need to remove all of the following words: "Hump YM", "Trim YM", or "NX". Lastly, I use TRIM to remove any extra spaces.

For example, if column C contains:
Code:
[TABLE="width: 1100"]
<tbody>[TR]
[TD="width: 1100"]Trim YM Remove  Block Deny Command Failed -- Invalid Slot Number -- Operator: 2Request: NBUC,[/TD]
[/TR]
</tbody>[/TABLE]
The formula should return:
Code:
Remove Block Deny Command Failed


The formula I came up with isn't working:

Code:
=TRIM(SUBSTITUTE(LEFT($C3,SEARCH({":","-","FOR","for"},$C3)-1),{"Hump YM","Trim YM","NX"},""))

Excel doesn't seem to be recognizing the lists given in {curly braces}, only the first item in each list. Please help!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
With your target text in A1
and these lists of search terms in F1:G3
Code:
:     HUMP YM
-     Trim YM
FOR   NX

This formula parses that text to only display the error reason:
Code:
B1: =TRIM(MID(LEFT(A1,MIN(INDEX(SEARCH($F$1:$F$3,A1&":-FOR"),0))-1),LEN(LOOKUP(2,
1/COUNTIF(A1,"*"&$G$1:$G$3&"*"),$G$1:$G$3))+1,100))
Is that something you can work with?
 
Upvote 0

Forum statistics

Threads
1,215,506
Messages
6,125,197
Members
449,214
Latest member
mr_ordinaryboy

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