Conditional requiring of fields using SharePoint 2010 List Validation

My customer wanted to be able to make a field required only if another field had a specific value, AKA Conditional Requiring.   While SharePoint has the ability to make fields required (or even check for uniqueness) it still does not yet have the ability to make a field required based on another.  That is where List Validation comes in.

If you do not already know, List Validation (along with Column Validation) allows you to perform checks on fields to make sure that they pass certain requirements.  They can be as simple as checking to make sure a field has a specific value to some rather complex (and cool) validations.  I forget who did it but I saw a “poor man” validation to make sure a human was entering a comment by making sure they entered in the first 3 letters of the today’s day.

Here is my setup.  I have two different fields, FieldA and Field B.   The field names have been changed to protect the innocent 🙂   They are both choice fields, although I would think they could be just about any field type,***certain fields like LOOKUP will not work here and the fields do not actually show up in the validation settings form*** and FieldA is required while FieldB is not.  I also setup FieldB so it does not have any default value.

 In my case I need to check two different things.  The first was that FieldA contained a specific value and if it did (and only if it did) I needed to make sure that FieldB had a selected value.  The first part is simple:


This just states that if FieldA has the value of “ShareBlog” then the validation passes, otherwise it fails.  If you want to ouput text, rather than just check to see if it validation passes you can use the IF function.  The above formula can be rewritten as:


This also checks to see if FieldA has the value of “ShareBlog” but in this case it will ouput “Pass” if it does or “Fail” if it doesn’t.   Pretty close to what I need but not quite there.  I could also use:


but this will just output “True” or “False” (and the validation will actually still fail).   Finally I realized I can take the quotes off of “True” and “False” and just use the static names.   Now I will get my validation to pass if FieldA has the value of “ShareBlog” again.  Almost there.

Now I just need to check to make sure that FieldB has a value.   That is simple enough:


What I need to do now is to embed the two IF statements together to create the new one:


Sharp eyed readers may have notticed that for the outter IF statement I am actually returning TRUE no matter if FieldA has the value of “ShareBlog” or not.   That is not quite true.   If FieldA DOES contain “ShareBlog” then I want to make sure that FieldB has a value so I go into the second IF statement which will return a TRUE if FieldB has a value or FALSE if it doesn’t.   If FieldA DOESN’T contain “ShareBlog” then I don’t care what FieldB has for a value so I will always return TRUE.

That should do it.   You can throw some AND functions in there as needed if you need to check more fields

12 Responses to “Conditional requiring of fields using SharePoint 2010 List Validation”

  1.   Michelle Says:

    Thank you. I have a question though. This statement:

    =IF([Track Time?]=”Yes”,IF([Actual Work Effort]””,TRUE,FALSE),TRUE)

    Makes “Actual Work Effort” required if “Track Time?” is equal to Yes. How would I require it if Track Time is yes AND another field (Completion Date) is not blank?

    •   Gary Bushey Says:

      You can add more IF statements so you could do =IF([Track Time?]=”YES”,IF([Completion Date])=””,…..

  2.   Susan Says:

    This is exactly what I am looking for, however, when I go to build this formula several of my list fields do not appear in the validation settings. They are both Choice fields. When I go into the columns to see if I can set column validation settings the validation settings are not available within the columns themselves either.

    Do you know why these would not be available and what I need to do to fix this?

    •   Gary Bushey Says:

      I am not 100% certain but it probably has something to do with the way choice fields are stored in the database. Sorry

  3.   sid jain Says:

    how to create validation condition for check box ?
    for example
    than only I should be allowed to select value in the next column !
    Help will be much appreciated !!

  4.   Jen Says:

    Thank you!!! This is working awesome in Sharepoint, however, when I try to create a Nintex form it no longer works. Any suggestions? I’d really appreciate the help!

Leave a Reply