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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort Option 2

Status
Not open for further replies.

faush

MIS
Mar 6, 2001
38
0
0
US
I have formatted badges in Crystal, and need help sorting.

The name field is one field, which contains first, middle, last. Not everyone has a middle initial.

How do I sort by last name only? I'm using the StringAfterChar formula, but still not producing the results I need.

Ex. of badge names:

JOHN A. DOE
JOHN DOE
JOHN ALLEN DOE

Thanks!
 
faush: Assuming that last name is the last text in the field i.e. you don't also have "Esq." or "B.A. (Hons)" etc. then try the following:

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

this works by using InStrRev() to find the posistion measured in from the left of the last space in the name by reversing it and finding the first occurence! In your examples it would return 8,5,11 respectively. Then Mid() returns the remainder of the string from the next position - i.e. start of lastname - to the end

Hope this helps David C. Monks
david.monks@chase-international.com
Accredited Seagate Enterprise Partner
 
Thanks sooooo much, this is finally working!!!!!

You are a lifesaver!
 
For what it is worth, I needed this exact thing and it works like a champ!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top