1

I'm trying to create a calculated field with the following formula, but when I try to save the column with this formula it returns a syntax error.

What's wrong with the formula?

Formula:

= IF(
  OR(
    AND([daysinadvance] >= 14, [totaldays] >= 1), 
    AND([daysinadvance] < 14, [totaldays] < 7)
  ), 
  "Pass", 
  "Fail"
)

Basically if somebody take a leave more than 14 days in advance he is allowed to take anything more than 1 day or if somebody take a leave less than 14 days in advance he is allowed to take anything less than 7 days.

5
  • 1
    What are your column types for [daysinadvance],[totaldays] and your calculated column? I have created these columns in a SharePoint list as number columns and your formula works fine.
    – user79408
    May 11, 2022 at 5:25
  • Your formula syntax looks fine. Check if you are having correct data types for your columns. Sometimes comma(,) does not work in formula, in that case use semicolon(;) instead of comma(,). Let me know if this works for you. May 11, 2022 at 6:43
  • @GaneshSanap Thank you! Your assumption was correct. I have changed the formula to the local format and it works! My actual formula is in Russian and looks like: =ЕСЛИ(ИЛИ(И([daysinadvance]>=14; [totaldayss]>=1); И([daysinadvance]<14; [totaldayss]<7)); "Pass"; "Fail")
    – TGS
    May 11, 2022 at 7:13
  • @user79408 Thank you for your time to clarify my doubts! I have changed the formula to the local format and it works! My actual formula is in Russian and looks like: =ЕСЛИ(ИЛИ(И([daysinadvance]>=14; [totaldayss]>=1); И([daysinadvance]<14; [totaldayss]<7)); "Pass"; "Fail")
    – TGS
    May 11, 2022 at 7:20
  • I have added the answer below. Please Upvote(^) and accept as an Answer as it helped you & it will help others with similar question in future to find the correct answer easily. It also removes this question from "Unanswered questions" list. Dec 5, 2022 at 11:30

1 Answer 1

0

Your formula syntax looks fine to me. Try below suggestion:

Sometimes comma(,) does not work in calculated column formula (I am not sure but it is based on something language or regional settings on your site). So in that case use semicolon(;) instead of comma(,).

Documentation: Calculated Field Formulas

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.