Forum Discussion
SharePoint list validation formula error
Your formula appears to be a complex combination of conditions for list validation in SharePoint. While SharePoint's list validation feature is quite powerful, it can be a bit tricky to get the syntax right. Here are some suggestions and corrections to your formula:
- Syntax Errors: SharePoint formulas are sensitive to whitespace and syntax. Remove any unnecessary spaces and make sure your commas and parentheses are properly placed.
- Nested IF Statements: SharePoint does not support nested IF statements directly. You should use multiple IF statements separately.
- Use of OR and AND Functions: In your formula, you are using both AND and OR functions. It is important to understand their usage. AND requires all conditions to be true, while OR requires at least one condition to be true.
Based on your description, here is how you might structure your validation formula:
=AND( IF([Confirm]="I request a different location", IF(OR([Choices]="", [Rationale]=""), FALSE, TRUE), TRUE ), IF( OR([Location]="A", [Location]="B", [Location]="C"), IF( FIND([Location], [Choices])<>0, FALSE, TRUE ), TRUE ) )
This formula does the following:
- Checks if "Confirm" equals "I request a different location." If it does, it checks if either "Choices" or "Rationale" is empty. If not, it returns TRUE. If "Confirm" is not "I request a different location," it returns TRUE (since there is no need to validate the other conditions).
- Checks if "Location" is "A," "B," or "C." If it is, it checks if "Location" exists in the "Choices" column using the FIND function. If it does not exist (i.e., FIND returns 0), it returns TRUE. If "Location" is not one of those values, it returns TRUE (again, because there is no need to validate the other conditions).
Please adapt this formula to your specific requirements and verify if it works correctly for your scenario. Keep in mind that SharePoint list validation can sometimes be challenging due to its specific syntax and limitations.The text and steps were created with the help of AI.
My answers are voluntary and without guarantee!
Hope this will help you.
Was the answer useful? Mark them as helpful and like it!
This will help all forum participants.
- CristinaMoralesSep 08, 2023Copper ContributorHello. Thank you so much for this. It got me a bit further, but it's still not working. Presently, the validation won't let me save any change to the list, even when Location is "A" and choice is "B".
=AND( IF([Confirm]="I request a different location", IF(OR([Choices]="", [Rationale]=""), FALSE, TRUE), TRUE ), IF( OR([Location]="A", [Location]="B", [Location]="C"), IF( FIND([Location], [Choices])<>0, FALSE, TRUE ), TRUE ) )