View Full Version : Extract word from string


FREDDY67
03-27-2009, 02:19 AM
Morning

I would like to see if a cell contains a specific word in a string & if it does write the specific word in a new cell, I can do this easily with a data filter text contains but I want to do it with a formula.

Any help appreciated.

Thanks

Freddy

chergh
03-27-2009, 02:52 AM
I don't think you can without writing your own function.

FREDDY67
03-27-2009, 04:02 AM
chergh

thanks for info, i'll use access I know where I am there.

Cheers

Freddy

ajetrumpet
03-27-2009, 06:25 AM
wouldn't this work in the new cell?:=if(instr(old cell number, "string") > 0, "string", "")

chergh
03-27-2009, 06:43 AM
No, instr is only available in vba.

ajetrumpet
03-27-2009, 07:04 AM
I'm getting the idea that you don't like me chergh. I will stay away. :)

chergh
03-27-2009, 07:17 AM
Yeah explaining why your idea wouldnt work was very nasty of me.

lemo
03-31-2009, 10:27 AM
if you have

Freddy67 wants answers.

in cell A1,

the following should extract the word "wants" -

=MID(A1,SEARCH("wants",A1),SEARCH(" ",A1,SEARCH("wants",A1))-SEARCH("wants",A1))

peace,
l

boblarson
03-31-2009, 10:31 AM
No, instr is only available in vba.

SEARCH is the Excel Function equivalent of INSTR.

DanWall
03-31-2009, 02:59 PM
example
A1: This is some text
A2: some
A3: =IF(ISERROR(SEARCH(A2,A1)),"Not Found",A2)

The cell A3 will return "some".
If the value in A2 can't be found, then A3 will return "Not Found".
You can change that to whatever you want.