function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Brennan ButlerBrennan Butler 

If statement to add to Validation rule........................

I am not even sure if this is possible, I am slightly new to the coding world, but I have a validation rule as follows:
AND( 
ISNEW(), 
Name = UPPER(Name) 
)
I need to place an IF statment to allow Lettered companies to be added with all caps. Such as we have a company called TRG, so it will not allow us to add this as all caps with the above rule. Is there way to make it allow all caps for companies that need it.

Thank you in advance for your help.
Best Answer chosen by Brennan Butler
Sanjay Mulagada 11Sanjay Mulagada 11
So try using LEN() to count the number of characters,

AND(
LEN(Name)>4,
ISNEW(), 
Name = UPPER(Name) 
)

Thank you,
Sanjay

All Answers

Sanjay Mulagada 11Sanjay Mulagada 11
Well Brennan, what your asking is kind of confusing, I see the validation is set up to fire if the Name is all Caps.
Do you already have a list of companies that can be allowed ?
If yes, then you're validation will be like -
AND(
NOT(Name='TRG'),
ISNEW(), 
Name = UPPER(Name) 
)
If not, to allow Letterhead Companies let say we have a company named ABC and another company with name TEETETET and you want the validation to fire on the second but not on the first, then what will the criteria be ? If you can explain me that then I can build the formula to you.
Brennan ButlerBrennan Butler
I think I understand what you are looking for. 
So if we have a company name that has more than 5 letters we need to have the restriction on all caps fire. If the company name is 4 letters or below we need to allow all uppercase as that could be a letterhead company. I hope that explains it, I can see it in my head, but getting it on paper is a little more difficult.

Thank you,
Brennan
Sanjay Mulagada 11Sanjay Mulagada 11
So try using LEN() to count the number of characters,

AND(
LEN(Name)>4,
ISNEW(), 
Name = UPPER(Name) 
)

Thank you,
Sanjay
This was selected as the best answer
Brennan ButlerBrennan Butler
Thank you, that worked perfectly