+ Start a Discussion
Abby StockerAbby Stocker 

Proper case

Hello, Our accounts are brought in from our data warehouse. In there, all account names are written in all uppercase (JOHN SMITH) I created a formula field that makes it proper case for email templates (John Smith). The problem is if someone entered the customer's first name as "JOHN & JANE" their name appears like this, "John & jane Smith" (j in Jane not being capitalized) Is there a way to fix this? Here is the code as it stands:

UPPER(MID(Order_Number__r.AccountId__r.FirstName, 1, 1))&LOWER( MID(Order_Number__r.AccountId__r.FirstName, 2,255)) &" "& UPPER(MID( Order_Number__r.AccountId__r.LastName, 1, 1))&LOWER( MID(Order_Number__r.AccountId__r.LastName, 2,255))

Thank you for any assistance! 
yogesh kherajaniyogesh kherajani
below logic can handle up to 2 spaces and if you need more than that you can go for apex code.

IF(
FIND(" ",  Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1)=0,
UPPER(LEFT(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1))&MID(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,2,100),
IF(
FIND(" ",MID(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName,1)+1,LEN(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName)-FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName,1)))=0,
UPPER(LEFT(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1))&
MID(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName,2,FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName,1)-1)&" "&
UPPER(MID(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1)+1,1))&
MID(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1)+2,100),
UPPER(LEFT(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1))&
MID(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,2,FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1)-1)&" "&
UPPER(MID(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1)+1,1))&
MID(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1)+2,FIND(" ",MID(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1)+1,LEN(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName )-FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1)))-1)&
UPPER(MID(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName,FIND(" ",MID(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName,FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1)+1,LEN(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName )-FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1)))+FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1)+1,1))&
MID(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,FIND(" ",MID(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1)+1,LEN(Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName )-FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName,1)))+FIND(" ",Order_Number__r.AccountId__r.FirstName &' '& Order_Number__r.AccountId__r.LastName ,1)+2,100)))
Abby StockerAbby Stocker
Hello, Thank you!! It looks like it may be too big?

Error: Invalid Data.
Review all error messages below to correct your data.
The size of your string is 4,268 bytes but may not exceed 4,000 bytes. (Related field: Formula)
yogesh kherajaniyogesh kherajani
You can create two formula field for Order_Number__r.AccountId__r.FirstName  and Order_Number__r.AccountId__r.LastName then it will not give error
Abby StockerAbby Stocker
I split up the formulas and unfortunately it is not working quite right but thank you!!!!!