Introduction
In this post we will cover few more SharePoint column validation examples implementing Capital Letters scenario with their formulas.
You can check my earlier post http://adicodes.com/capital-letter-validation-in-sharepoint/ with detailed example for capital letter validation
You can check my earlier post http://adicodes.com/capital-letter-validation-in-sharepoint/ with detailed example for capital letter validation
1. SharePoint validation – first two letters should be capital letters
Considering column ‘FirstName’ as single line of text type
Formula
=AND(
CODE(UPPER(MID(FirstName,1,1)))=CODE(MID(FirstName,1,1)),
CODE(UPPER(MID(FirstName,2,1)))=CODE(MID(FirstName,2,1))
)
CODE(UPPER(MID(FirstName,1,1)))=CODE(MID(FirstName,1,1)),
CODE(UPPER(MID(FirstName,2,1)))=CODE(MID(FirstName,2,1))
)
This formula will enforce first two letters of ‘FirstName’ column should be in capital letters
If I give ADiseshu as input it will allow, but if I give the value as Adiseshu it will not allow
If I give ADiseshu as input it will allow, but if I give the value as Adiseshu it will not allow
2. SharePoint validation – all letters should be in capital letters
Considering column ‘LastName’ as single line of text type and ‘LastName’ length as 5 letters.
For each digit we are adding code line to check. If we have more digits, then add for them also.
For each digit we are adding code line to check. If we have more digits, then add for them also.
Formula
=AND(
CODE(UPPER(MID(LastName,1,1)))=CODE(MID(LastName,1,1)),
CODE(UPPER(MID(LastName,2,1)))=CODE(MID(LastName,2,1)),
CODE(UPPER(MID(LastName,3,1)))=CODE(MID(LastName,3,1)),
CODE(UPPER(MID(LastName,4,1)))=CODE(MID(LastName,4,1)),
CODE(UPPER(MID(LastName,5,1)))=CODE(MID(LastName,5,1))
)
CODE(UPPER(MID(LastName,1,1)))=CODE(MID(LastName,1,1)),
CODE(UPPER(MID(LastName,2,1)))=CODE(MID(LastName,2,1)),
CODE(UPPER(MID(LastName,3,1)))=CODE(MID(LastName,3,1)),
CODE(UPPER(MID(LastName,4,1)))=CODE(MID(LastName,4,1)),
CODE(UPPER(MID(LastName,5,1)))=CODE(MID(LastName,5,1))
)
This formula will enforce ‘LastName’ value should be in capital letters.
If I give DASARI as input it will allow, but if I give the value as Dasari it will not allow
If I give DASARI as input it will allow, but if I give the value as Dasari it will not allow
Note that, these are column level validations as formula involves with column itself not with another column. So, validation rule should be provided at
List Settings > select column under columns > Add formula under Column Validation
List Settings > select column under columns > Add formula under Column Validation
No comments:
Post a Comment