I am attempting to put some validation into a list (List Settings > List validation) and I am struggling to get it to work.
I have a list with 3 fields in it:
- Job Type
- Partner
- Agent
Job Type has the following options in it:
- Call
- Outbound Call
- Saturday
- Engineer
The other fields are also lists but this information is not important for this scenario.
When my team fill in the form I need to validate it to ensure the correct information is in place as follows:
If Job Type = Call then we need to make sure the Partner OR Agent field is completed - I have done this with the following code:
=AND(NOT(AND(Agent<>"",[H2H Partner]<>"")),NOT(AND(Agent="",[H2H Partner]="")))
This works perfectly. However my issue is the next bit:
If Job Type <> Call then allow both fields to be blank.
In Excel I have managed to do this using the following code:
=IF(A5="Call", IF(AND(NOT(AND(B5<>"",C5<>"")),(NOT(AND(B5="", C5="")))),"True","False"),"Partner & Agent Allowed Blank")
This, however, doesn't translate into Sharepoint, as it seems to ignore the initial if statement and tests the rest of it. I have attempted to drop the IF statement itself, as the list validation is an assumed IF.
Obviously, I don't need the formula to return the last part of it as I just need it to evaluate to TRUE to return the custom message we have.
I hope this explains everything, and I do hope someone can help me out with this.