Forum Home
Press F1
 
Thread ID: 9916 2001-06-23 05:04:00 Excel - Word/text functions Guest (0) Press F1
Post ID Timestamp Content User
14519 2001-06-23 05:04:00 Is it possible to extract a word from a text string in a cell?

Say, the third word in a sentence?

Appreciate your input.
Regards
Graham Bockett
Guest (0)
14520 2001-06-24 06:19:00 I don't think there is a function to do it, but as a manual method, you can split text to columns (Data menu; text to columns ...; follow Wizard), after copying the text into a separate sheet or suitable remote cell first if necessary to preserve the original and to keep it out of the way of other things.

Then pick whichever cell (and therefore word) that you want.

If no-one has a better suggestion but you want something more, I can try to work something out that would use a macro, but without too many guarantees.
Guest (0)
14521 2001-06-24 12:52:00 Thanks for that thought John, I'll try it out and see if it solves my challange.

Regards
Graham Bockett
Guest (0)
14522 2001-06-25 00:00:00 The following formula will extract the third word from a sentence in cell A1 - provided that there is only a single space between each word.

=MID(A1,FIND(' ',A1,FIND(' ',A1,1)+1)+1,FIND(' ',A1,FIND(' ',A1,FIND(' ',A1,1)+1)+1)-FIND(' ',A1,FIND(' ',A1,1)+1))

HTH
Guest (0)
14523 2001-06-25 02:10:00 I now have a generalised user-defined function to return whichever word you want from a sentence. You can also choose what separators to use, so you could include parentheses as well as spaces, for example. (I've found how to create user-defined functions! Yippee!).

Let me know if you're interested. I've had problems before trying to send long replies in this forum, and don't think I can send it all in one go, complete with instructions.
Guest (0)
14524 2001-06-25 05:03:00 Hi John

Please tell me more!

It would be appreciated if you could email me direct on <gbockett@paradise.net.nz> with info on your 'user-defined function', both the sp[ecific one I asked about, and any 'yippee' advice you can pass on!
Guest (0)
14525 2001-06-25 05:07:00 Thanks for that Russell. It looks very interesting, BUT I would like to be able to understand it so I can modify it for other words (Second, Fourth etc)!

Regards
Graham
Guest (0)
1