Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting Last Name from a Field 1

Status
Not open for further replies.

EricMa

Technical User
Aug 10, 2000
21
0
0
US
I have a single field in my report which contains First Name and Last Name (John Smith). I would like to extract the last name so I can group the report by last name. Can someone give me some pointers on creating this formula? is currently down. Thanks.
 
Hi There,

Check out the "Extract String" function.

Nuffsaid.
 
Hi,

Try using this formula, it worked for me.

Mid(Name,InStrRev(Name," ")+1)

Hamida
 
Hi,

Note that this formula will not cater for double barreled names, eg. Fred Palmer Smith.

There is no simple way of stripping off surnames correctly unless either 3 separate fields are used or names are held as Surname,Forename Middlename(s)

Even with this format you have to be careful where no middlename exists!

Hth,
Geoff
 
With CR8, you could also use InstrRev to search for the last space in someone's name -
but it wouldn't handle people with two/multiple word Surnames von xxx, van der xxx, te xx, le xxx, etc. (Ie. foreigners)
Editor of Crystal Clear
 
Try using the StrReverse function on the name field first, which will reverse the string and put the last name at the start of the string. Then use the functions noted in previous responses to extract just the last name. Once done, use the StrReverse again if needed to flip the name again for display. Jim Varco
Varco Consulting
jimvarco@worldnet.att.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top