Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Split first name and Surname

Dear All

I have a column of text made up of surname middle initial,Firstname (i.e
Bloggs A,Fred)

What I am trying to do is to take the first name and use it in an email
function I have created. So I need VB to extract the first name.

Can anyone help

Regards

Newman

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Split first name and Surname

try this, if the name is in cell A1

=RIGHT(A1,LEN(A1)-FIND(",",A1,1))

--


Gary


"Newman Emanouel" wrote in message
...
Dear All

I have a column of text made up of surname middle initial,Firstname (i.e
Bloggs A,Fred)

What I am trying to do is to take the first name and use it in an email
function I have created. So I need VB to extract the first name.

Can anyone help

Regards

Newman



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Split first name and Surname

VB you say?:

firstName = Split(Selection, ",")(1)

will work if there's only one comma in the string.

And if there are errant spaces after the comma or after the end of the first
name then a refinement:

firstName = WorksheetFunction.Trim(Split(Selection, ",")(1))

will get rid of them.
--
p45cal


"Gary Keramidas" wrote:

try this, if the name is in cell A1

=RIGHT(A1,LEN(A1)-FIND(",",A1,1))

--


Gary


"Newman Emanouel" wrote in message
...
Dear All

I have a column of text made up of surname middle initial,Firstname (i.e
Bloggs A,Fred)

What I am trying to do is to take the first name and use it in an email
function I have created. So I need VB to extract the first name.

Can anyone help

Regards

Newman




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
Sorting by surname when first name and surname are in the same cel Louise New Users to Excel 3 April 5th 23 02:50 PM
Split surname from end of name data Serena Excel Worksheet Functions 4 October 10th 07 11:18 PM
Change around surname and name kassie Excel Discussion (Misc queries) 8 June 10th 07 07:01 AM
Display only surname Pat Excel Worksheet Functions 2 June 23rd 05 10:30 PM
Name Surname combination Seaman Excel Programming 2 June 11th 05 09:23 AM


All times are GMT +1. The time now is 01:10 AM.

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"