pulling text from a string

MikeyZ

Well-known Member
Joined
Mar 14, 2002
Messages
553
How can I pull certain text from a string using an fx?

In my target column I only have two different sentences.

OSV to Bulk Anodize
OSV to Rack Anodize

depending on which one it is, I only want to extract either the Bulk or the Rack text.

How can I do that?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Since you have only two sentences, both have the same amount of chars, and both words also have the same amount of chars...
Let's say your target column is E. You could write this:

Excel 2016 (Windows) 32 bit
EF
OSV to Bulk AnodizeBulk
OSV to Rack AnodizeRack

<tbody>
[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH]F2[/TH]
[TD="align: left"]=MID(E2,8,4)[/TD]
[/TR]
[TR]
[TH]F3[/TH]
[TD="align: left"]=MID(E3,8,4)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
Not always the case.
Some might say: Bulk Anodize Red, Rack Anodize Only OSV to Rack Anodize

Should have been more specific, sorry.
 
Upvote 0
Here is one way (for an example in cell A1):
Code:
=IF(ISNUMBER(FIND("Bulk",A1)),"Bulk",IF(ISNUMBER(FIND("Rack",A1)),"Rack",""))
 
Upvote 0
Here is one way (for an example in cell A1):
Code:
=IF(ISNUMBER(FIND("Bulk",A1)),"Bulk",IF(ISNUMBER(FIND("Rack",A1)),"Rack",""))
The OP's example in Message #3 has both key words in it, so I think you will need to change this to look for the key phrases the OP said would be in the text...
Code:
=IF(ISNUMBER(FIND("OSV to Bulk Anodize",A1)),"Bulk",IF(ISNUMBER(FIND("OSV to Rack Anodize",A1)),"Rack",""))
 
Last edited:
Upvote 0
I tried the fx with H2 replacing A1. Didn't work.
The text was as follows: Rack. The Fx has it in all CAPS. So I tried replacing the RACK with Rack and it worked.
How do I get around the case sensitivity?

Typing this has been a challenge because for some reason not al the letters I hit on my keyboard register on the screen. I have a new keyboard.
 
Upvote 0
I tried the fx with H2 replacing A1. Didn't work.
The text was as follows: Rack. The Fx has it in all CAPS. So I tried replacing the RACK with Rack and it worked.
How do I get around the case sensitivity?
Maybe this...
Code:
=IF(ISNUMBER(SEARCH("OSV to Bulk Anodize",H2)),"Bulk",IF(ISNUMBER(SEARCH("OSV to Rack Anodize",H2)),"Rack",""))
 
Upvote 0
How can I pull certain text from a string using an fx?

In my target column I only have two different sentences.

OSV to Bulk Anodize
OSV to Rack Anodize

depending on which one it is, I only want to extract either the Bulk or the Rack text.

How can I do that?

Hi,

Just another way.

Your description seems to imply you have the criterion/sentences you want to look up in a column.
You can "hard-code" the results in the formula (as in my sample B1), or you can Also list the results you want in a column and use cell references (as in my sample C1).
With the latter, you can easily "add" sentences and results to the "list" if needed, and change the LOOKUP range and RESULT range in the formula.


Book1
ABCFGH
1Bulk Anodize Red, Rack Anodize Only OSV to Rack AnodizeRackRackOSV to Bulk AnodizeBulk
2Bulk Anodize Red, OSV to Bulk Anodize, Rack Anodize OnlyBulkBulkOSV to Rack AnodizeRack
3Bulk Anodize Red, Bulk Anodize Only, Rack Anodize Only
Sheet159
Cell Formulas
RangeFormula
B1=IFERROR(LOOKUP(2,1/SEARCH(G$1:G$2,A1),{"Bulk","Rack"}),"")
C1=IFERROR(LOOKUP(2,1/SEARCH(G$1:G$2,A1),H$1:H$2),"")


Formulas copied down.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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