You need to sign in to do that
Don't have an account?

Has anyone ever created a formula to proper case fields?
Has anyone ever created a formula to proper case fields?
Thank you,
Steve
You need to sign in to do that
Don't have an account?
Has anyone ever created a formula to proper case fields?
Thank you,
Steve
Steve,
What are you looking for?
The solution to your inquiry won't be a formula, at least not without a workflow rule, but more likely Apex Code that could process the field using a combination of String.splitbycharactercamelcase, String.capitalize, and String.join (new Winter '13 features).
Try this one out. It capitalizes multiple words and has worked excellently so far for us. Just replace LastName with any field you want to use it on!
IF(
FIND(" ", LastName ,1)=0,
UPPER(LEFT(LastName ,1))&MID(LastName ,2,100),
IF(
FIND(" ",MID(LastName ,FIND(" ",LastName ,1)+1,LEN(LastName )-FIND(" ",LastName ,1)))=0,
UPPER(LEFT(LastName ,1))&
MID(LastName ,2,FIND(" ",LastName ,1)-1)&" "&
UPPER(MID(LastName ,FIND(" ",LastName ,1)+1,1))&
MID(LastName ,FIND(" ",LastName ,1)+2,100),
UPPER(LEFT(LastName ,1))&
MID(LastName ,2,FIND(" ",LastName ,1)-1)&" "&
UPPER(MID(LastName ,FIND(" ",LastName ,1)+1,1))&
MID(LastName ,FIND(" ",LastName ,1)+2,FIND(" ",MID(LastName ,FIND(" ",LastName ,1)+1,LEN(LastName )-FIND(" ",LastName ,1)))-1)&
UPPER(MID(LastName ,FIND(" ",MID(LastName ,FIND(" ",LastName ,1)+1,LEN(LastName )-FIND(" ",LastName ,1)))+FIND(" ",LastName ,1)+1,1))&
MID(LastName ,FIND(" ",MID(LastName ,FIND(" ",LastName ,1)+1,LEN(LastName )-FIND(" ",LastName ,1)))+FIND(" ",LastName ,1)+2,100)))
I've added two slight improvements to better fulfil the need, and fixed an error
However, hoping one or both of you could brilliant formula gurus could add some additional tweaks to @Anthony Gore's version:
1) Is it possible to expand it (without going over compile limits) to account for up to 5-6 spaces? For example, won't work with some longer person-based common street names used throughout the US, e.g. "3500 John F. Kennedy Blvd" (turns into 3500 John F. kennedy blvd) :-\
2) Could you add logic to treat dashses as spaces also, e.g. Mary-Ellen? Apostrope too, perhaps. That would be amazing! Although depending on use case (e.g. ethnic name origin, first vs. last name), preference may be to capitalize or not capitalize the following character (e.g. A'niyah vs. O'Dell)
https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FMnRpUAL
If anyone is still looking, this formula will work in Process Builder. We are currently using it to format names:
UPPER(LEFT([Object].FirstName,1))&LOWER(Mid([Object].FirstName, 2, Len([Object].FirstName)-1))
This takes:
SCOTT SMITH and turns it into Scott Smith
scott smith and turns it into Scott Smith
I hope this helps someone!
@Scott Smith 107
I am working on process builder, but given formula is not working to me. Please update me if changes or suggest me how should i
Thanks
Thank you for your formula! I'm using it for our Name fields on Person Accounts since we will begin using these fields for correspondence. Your formula works great, except we have a lot of "Mac"s where I'm from (MacDonald, MacNeil) and so it doesn't seem to work if there is no space or hyphen (which makes sense). Do you have any suggestion how this can be improved to ensure these names have proper casing so that if someone inputs MACDONALD, it doesn't switch to Macdonald, but MacDonald (or Mac Donald would be acceptable too)?
Hi @Miriam Betzner,
Try the below iteration and let me know if that works.
Thanks,
Anthony