Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Extract given and surname a string

Hi,

Excel 2003.

I have the following example text in Sheet1 cell A2 (it is pasted from
another application) :
AgentSmith Mary (12178)

It is made up of:
"Agent" - Constant text
"Smith" - Surname (Variable text and length)
"Mary" - Given name (Variable text and length)
"(12178)" - Identifying number (Actual number and length will vary. Brackets
will always be constant).


I would like to extract both the given and surname (proper case) and place
the result in Sheet2 cell B19, like so:
Mary SMITH

Any assistance would be appreciated.

Cheers

Bob


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Extract given and surname a string

On Sun, 29 Apr 2007 11:33:09 +1000, "Bob Maloney" wrote:

Hi,

Excel 2003.

I have the following example text in Sheet1 cell A2 (it is pasted from
another application) :
AgentSmith Mary (12178)

It is made up of:
"Agent" - Constant text
"Smith" - Surname (Variable text and length)
"Mary" - Given name (Variable text and length)
"(12178)" - Identifying number (Actual number and length will vary. Brackets
will always be constant).


I would like to extract both the given and surname (proper case) and place
the result in Sheet2 cell B19, like so:
Mary SMITH

Any assistance would be appreciated.

Cheers

Bob


Given your fairly precise format, the following should work:

=PROPER(MID(Sheet1!A2,FIND(" ",
Sheet1!A2)+1,FIND("(",Sheet1!A2)-FIND(" ",
Sheet1!A2)-1))&UPPER(MID(Sheet1!A2,6,
FIND(" ",Sheet1!A2)-6))

I'm not sure, from your description, if the PROPER function is necessary. If
not, then:

=MID(Sheet1!A2,FIND(" ",Sheet1!A2)+1,
FIND("(",Sheet1!A2)-FIND(" ",Sheet1!A2)-1)&
UPPER(MID(Sheet1!A2,6,FIND(" ",Sheet1!A2)-6))


--ron
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Extract given and surname a string

Exactly what I needed, many thanks Ron.

Cheers

Bob

"Ron Rosenfeld" wrote in message
...
On Sun, 29 Apr 2007 11:33:09 +1000, "Bob Maloney"
wrote:

Hi,

Excel 2003.

I have the following example text in Sheet1 cell A2 (it is pasted from
another application) :
AgentSmith Mary (12178)

It is made up of:
"Agent" - Constant text
"Smith" - Surname (Variable text and length)
"Mary" - Given name (Variable text and length)
"(12178)" - Identifying number (Actual number and length will vary.
Brackets
will always be constant).


I would like to extract both the given and surname (proper case) and place
the result in Sheet2 cell B19, like so:
Mary SMITH

Any assistance would be appreciated.

Cheers

Bob


Given your fairly precise format, the following should work:

=PROPER(MID(Sheet1!A2,FIND(" ",
Sheet1!A2)+1,FIND("(",Sheet1!A2)-FIND(" ",
Sheet1!A2)-1))&UPPER(MID(Sheet1!A2,6,
FIND(" ",Sheet1!A2)-6))

I'm not sure, from your description, if the PROPER function is necessary.
If
not, then:

=MID(Sheet1!A2,FIND(" ",Sheet1!A2)+1,
FIND("(",Sheet1!A2)-FIND(" ",Sheet1!A2)-1)&
UPPER(MID(Sheet1!A2,6,FIND(" ",Sheet1!A2)-6))


--ron



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Extract given and surname a string

On Sun, 29 Apr 2007 12:16:32 +1000, "Bob Maloney" wrote:

Exactly what I needed, many thanks Ron.

Cheers

Bob


You're welcome. Thanks for the feedback.
--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
Extract from string mark Excel Discussion (Misc queries) 2 August 8th 06 12:38 PM
Extract text from String Dan Excel Worksheet Functions 8 July 1st 06 12:39 PM
extract date from string kdp145 Excel Worksheet Functions 3 March 3rd 06 02:54 PM
Extract sub string sixbeforedawn Excel Worksheet Functions 2 October 24th 05 09:50 AM
Extracting Surname from within a text string Iainkerr01 Excel Worksheet Functions 6 March 14th 05 10:16 AM


All times are GMT +1. The time now is 02:54 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"