This SharePoint tutorial contains a few SharePoint 2013 list column validation examples. After reading this tutorial, you will get to know how to implement list column validations in SharePoint Online or SharePoint 2013/2016.
Here I have explained, 5 SharePoint list column validation examples.
SharePoint list column validation example-1
We will see a few examples of how column validation works for a particular item in the SharePoint List.
Here my requirement is I have a SharePoint 2013 list which contains a Title column, I want user should be able to put only “Mr” or “Mrs”. If users put something else other than this, then it should give an error message saying You can put only Mr or Mrs.
To use validation for a particular column, follow the below steps:
Open your SharePoint List, then go to List Settings. In the Settings page, go to the Columns section and then click on the particular column for which you want to use the validation. In my case, it is the Title Column.
This will open the Edit Column page, here click on “Column Validation”. The in the Formula box put like below:
=OR(Title=”Mr”,Title=”Mrs”)
And in the User message, put the message which the user wants to see if the validation fails like: “Please only put Mr or Mrs”. The formula should look like below:
Then click on OK and Save the formula. Now try to add one item to the list. If you put any other thing apart from “Mr” or “Mrs” in the Title column, it should display the message like below:
SharePoint list column validation example-2
Similarly, If you want to validate another column, let’s say you have an age column and you want to show a validation message if the user put value less than 25.
You can write in the Column validation formula like below:
=(Age>25)
It should look like this:
Now when user try to put value less than 25, it will show a message like below:
SharePoint list column validation example-3 (First name and Last name should not be same)
Now we will see in another example, how to use SharePoint 2013 List validation settings. Here I have a SharePoint 2013 list which has two columns First Name and Last Name. My requirement here is if First Name and Last Name should not be the same, If the user enters the same value then it will display a validation message and data should not save to the list.
To use the List validation, Open your SharePoint 2013 list, then go to List Settings from the Ribbon. Then from the General Settings click on “Validation settings”.
Then in the Validation Settings page, In the formula box put:
=FirstName<>LastName
And in the User Message box, you can put the message which you want to display to the user when validation fails. It should look like below:
Now when you try to add an item and if you put first name and last name same, then it will display a message like below:
This way you can validate that, first name and last name can not be same.
SharePoint list column validation example-4 (Date should not be less than today)
Similarly, Suppose you have a Date type column and you want user should always select a date less than today, then you can write the formula as:
=DateOfJoining<Today()
Now if the user selects a date greater than today then it will display a message like below:
SharePoint list column validation example-5 (Length Should not be greater than N characters)
Similarly, if you want to validate the Title field length, then you can put the formula like below:
=LEN(Title)<25
And you can display a message like below:
The title should not be more than 25 characters. After this if the user tries to put title length more than 25 characters then it will display the message like below:
You may like following SharePoint list and library tutorials:
- How to create a site column in SharePoint 2013/2016/Online
- Display Task List data in a table using SharePoint REST API and filter by status column
- Create Collapsible tabs and All Columns tab using Infowise Ultimate Forms in SharePoint Online Office 365
- Change Column Order in List Forms (new/edit/display) in SharePoint 2013/2016/Online without using Code
- Create a column in a list using Rest API in SharePoint Online Office 365
- How to use SharePoint Alert Me feature in list or library
- Show total count of items in SharePoint 2013 list
- Follow/Unfollow SharePoint Online Site
- How to Change SharePoint List Column Width?
- Freeze Header Row in List View or Library on Scrolling using jQuery in SharePoint
Hope this SharePoint tutorial helps to learn how to implement list column validation in SharePoint 2013/2016 or SharePoint Online.
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Out audiences are from the United States, Canada, United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a SharePoint MVP(8 times), check out My MVP Profile. I have also worked in companies like HP, TCS, KPIT, etc.