SharePoint Column Validation

David Reisinger 1 Reputation point
2021-08-12T09:43:24.287+00:00

I have three fields that I'm trying to add column validation to:

Status (choice type)
Completed Date (date and time type)
Start date (date and time type)

I'm seeking a validation formula that resolves:

If [Status] = Completed, [Completed date] can't be blank, and must be >= [Start date]

Thank you

Microsoft 365 and Office SharePoint Development
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Yi Lu_MSFT 17,611 Reputation points
    2021-08-13T07:38:05.517+00:00

    Hi @David Reisinger
    You could apply the below formula via List settings> Validation settings> Formula to meet your need:
    =IF(AND([completed date]-[start date]<0,status="completed"),FALSE,TRUE)

    122976-image.png

    Then if [Status] = Completed, if [Completed date] is blank, or its value< [Start date], you will be not able to save the item and an error message will appear. You can set the User Message in the above Validation Settings page to customize the error message.

    123032-image.png


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. David Reisinger 1 Reputation point
    2021-08-17T16:08:09.227+00:00

    Hello, thank you for the assistance - it worked perfectly! An amazing resource and incredibly kind of the person who provided the solution - thanks!


  3. Andrei Cozma 1 Reputation point
    2022-02-16T06:46:33.977+00:00

    Have there been any changes to the Lists settings. When trying this now I am getting the following error: "The validation formula can refer to this column and not others"


  4. Jake Smith 1 Reputation point
    2022-03-11T16:14:02.787+00:00

    Hi @Yi Lu_MSFT ,

    I am receiving the following error message when trying to add a new "Issue" to my issue log on a SharePoint site.

    I have not added any column validation to the list and have had no issues adding items previously... any ideas?

    182259-image.png


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.