#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
zomex
 
Posts: n/a
Default help needed

eg. "mick jagger bush" "muhammad ali clay" "ayesha bin batool"
suppose that these r the names and i want formula that would be generic to
all, such that it gets "jagger" "ali" and "bin"
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JE McGimpsey
 
Posts: n/a
Default help needed

One way:

=TRIM(MID(LEFT(A1, FIND("$", SUBSTITUTE(A1, "_", "$", 2))),
FIND("_", A1), 32767))

where _ represents a space character to prevent unfortunate linewrap.

In article ,
"zomex" wrote:

eg. "mick jagger bush" "muhammad ali clay" "ayesha bin batool"
suppose that these r the names and i want formula that would be generic to
all, such that it gets "jagger" "ali" and "bin"

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JulieD
 
Posts: n/a
Default help needed

Hi Zomex

your teacher is obviously in a mean mood today :)

for this one - one answer involves a combination of MID and SEARCH functions

the way to approach it is
- locate the first space using the SEARCH function
- locate the second space using the SEARCH function (you'll have to nest the
first formula in here again to get your starting point), then subtract the
first formula again to calculate the number of chatacters between the two
spaces.

then nest these two formulas in the MID function.

Using the above method will give you leading and trailing spaces, these can
easily be edited out by modifying the formula (once you get that far).

Give it a go and if you'ld like more help, just post back.

Cheers
JulieD

julied at hctsReMoVeThIs dot net dot au


"zomex" wrote:

eg. "mick jagger bush" "muhammad ali clay" "ayesha bin batool"
suppose that these r the names and i want formula that would be generic to
all, such that it gets "jagger" "ali" and "bin"

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
zomex
 
Posts: n/a
Default help needed

thanks for the wonderful reply.... i couldnt get the middle name though the
formula that i was using sure did get me the last name and the3 formula is
=MID(E4,FIND(" ",E4,FIND(" ",E4)+1),LEN(E4)) ...the other formula did
work, but it shows the result like "0UsMan" and for even it shows
"1UmEr"...how can i remove this "0" abd "1"... :)

"JulieD" wrote:

Hi Zomex

your teacher is obviously in a mean mood today :)

for this one - one answer involves a combination of MID and SEARCH functions

the way to approach it is
- locate the first space using the SEARCH function
- locate the second space using the SEARCH function (you'll have to nest the
first formula in here again to get your starting point), then subtract the
first formula again to calculate the number of chatacters between the two
spaces.

then nest these two formulas in the MID function.

Using the above method will give you leading and trailing spaces, these can
easily be edited out by modifying the formula (once you get that far).

Give it a go and if you'ld like more help, just post back.

Cheers
JulieD

julied at hctsReMoVeThIs dot net dot au


"zomex" wrote:

eg. "mick jagger bush" "muhammad ali clay" "ayesha bin batool"
suppose that these r the names and i want formula that would be generic to
all, such that it gets "jagger" "ali" and "bin"

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default help needed

Maybe

=MID(E4,FIND(" ",E4,FIND(" ",E4)+1)+1,LEN(E4))

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"zomex" wrote in message
...
thanks for the wonderful reply.... i couldnt get the middle name though

the
formula that i was using sure did get me the last name and the3 formula is
=MID(E4,FIND(" ",E4,FIND(" ",E4)+1),LEN(E4)) ...the other formula

did
work, but it shows the result like "0UsMan" and for even it shows
"1UmEr"...how can i remove this "0" abd "1"... :)

"JulieD" wrote:

Hi Zomex

your teacher is obviously in a mean mood today :)

for this one - one answer involves a combination of MID and SEARCH

functions

the way to approach it is
- locate the first space using the SEARCH function
- locate the second space using the SEARCH function (you'll have to nest

the
first formula in here again to get your starting point), then subtract

the
first formula again to calculate the number of chatacters between the

two
spaces.

then nest these two formulas in the MID function.

Using the above method will give you leading and trailing spaces, these

can
easily be edited out by modifying the formula (once you get that far).

Give it a go and if you'ld like more help, just post back.

Cheers
JulieD

julied at hctsReMoVeThIs dot net dot au


"zomex" wrote:

eg. "mick jagger bush" "muhammad ali clay" "ayesha bin batool"
suppose that these r the names and i want formula that would be

generic to
all, such that it gets "jagger" "ali" and "bin"





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
 
Posts: n/a
Default help needed

On Tue, 3 Jan 2006 21:19:02 -0800, "zomex"
wrote:

eg. "mick jagger bush" "muhammad ali clay" "ayesha bin batool"
suppose that these r the names and i want formula that would be generic to
all, such that it gets "jagger" "ali" and "bin"



=LEFT(REPLACE(A1,1,FIND(" ",A1),""),FIND(" ",REPLACE(A1,1,FIND(" ",A1),""))-1)

Will find the first word after the first space.

If there may be multiple spaces within the string, then replace all A1 with
TRIM(A1)

On the other hand, a little more complex, imagine that you may have name
strings with 2, 3, or more names.

You might want to extract the first name, last name, and all of the middle
names separately. You also might want to be able to strip off Titles and such
(e.g. Mr., Ms., Jr, III, Sr.)

If this is a possibility, then regular expressions would be a more powerful
tool to use. You can look at that by installing Longre's free morefunc.xll
add-in from http://xcell05.free.fr

First Name: =REGEX.MID(TRIM(A1),"\w+")
Last Name: =REGEX.MID(TRIM(A1),"\w+$")
Middle Names: =REGEX.MID(TRIM(A1),"(?<=\s)(\w+\s)+")

Note that the formula for Middle Names will return a blank if there are only
two names (i.e. no middle name).


--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help summarizing data needed Jon Excel Worksheet Functions 4 November 27th 05 05:44 AM
solver related some financial knowledge may be needed Richard Payman Excel Discussion (Misc queries) 4 September 8th 05 02:37 PM
formula results take up to 2 lines if needed, but keep border smurf Excel Worksheet Functions 0 August 17th 05 08:55 PM
Custom percent format needed Will Fleenor Excel Worksheet Functions 1 June 29th 05 02:57 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM


All times are GMT +1. The time now is 09:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"