We recently had a request from a customer that wanted to prevent the Salesforce Opportunity Name from ending with a dash “-“. The default Opportunity naming convention when converting a Lead to an Opportunity is “Company Name-“. I tend to encourage this approach as well when creating an Opportunity from an Account or Contact. If you stick to an Opportunity name that contains the Account (Company) along with a descriptor of what is being purchased, you answer the question of Who and What in your Opportunity for quick reference.
To solve the request, we wrote this simple formula using the RIGHT function and added it to a Opportunity validation rule. This formula is looking at the Opportunity Name field and returning the value of the character that is in the first position when starting from the right of the string. If the result equals “-“, return TRUE which will validate the rule.
RIGHT( Name , 1) = "-"