extrating data from a string

A

alby

If I have a string:

"New York City"
how do I extract only the middle word (York)?

thanks in advance
 
B

Bob Phillips

In this particular instance, this works
=MID(A1,FIND(" ",A1)+1,FIND(" ",A1,FIND(" ",A1)+1)-FIND(" ",A1)-1)
but it wouldn't work for 99% of other city names.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
R

Ron Rosenfeld

If I have a string:

"New York City"
how do I extract only the middle word (York)?

thanks in advance

What kind of solution do you want.

Bob gave you a solution for three word strings.

But do you need something more general?

What do you want to happen if there are only two words; or if there are six or
seven words?


--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top