5

No matter how simple I make my formula I always get an error when I try to save a new calculated column with an IF statement in it. For example:

=IF("Foobar"="Foobar", "Foo", "Bar")

On save I get "The formula contains a syntax error or is not supported"

BTW. I'm using Sharepoint in Office 365

1
  • It would seem that in Office 365 you have to use semi-colons instead of commas it totally right, after trying a lot of working examples that were not working I almost get crazy, then I saw this post to use semi-colons and now it is working thanx a lot
    – Cavit
    Nov 12, 2018 at 17:54

6 Answers 6

10

Your formula is perfectly valid code

Language settings? Most non-english environments require a ; instead of ,

On English environments you can install a Bookmarklet to enhance the Calc editor

This blog might be of help too

3
  • Yip thanks, just posted the answer, but yours looks more complete. Marking as correct!
    – Jacques
    May 26, 2016 at 16:32
  • Out of interest, our environment is set to South African English, so what would make this different? Or is it perhaps because we use a comma to separate decimals?
    – Jacques
    May 26, 2016 at 16:34
  • 1
    If a comma is used to separate decimals, then it can not be used to separate parameters (as you would not be able to use decimals) , ergo the ; (semi-colon) is required. Same applies to formulas in Excel May 26, 2016 at 19:01
1

Same error displayed to me from SharePoint 2013 while creating a calculated column. See my formula below ('Date' is a DateTime column, I am trying to get 'Month Name-Year' format).

=TEXT(Date;"mmmm")&"-"&YEAR(Date)

Once I changed my site's Locale from German to English, The same formula worked perfectly. Later I reverted the locale back to German so that I can show Month names in German.

1
  • I can confirm changing the (sub)site's locale to English(UK) makes column validation work as expected (for English style formulae).
    – HKOB
    Jan 4, 2021 at 16:46
0

Try

=IF(EXACT("Foobar", "Foobar"), "Foo", "Bar")
0

You need to try this.

=IF([ColumnName]="Foobar", "Foo", "Bar")
0

It would seem that in Office 365 you have to use semi-colons instead of commas. Here's the working formula:

=IF("Foobar"="Foobar";"Foo";"Bar")
1
  • It depends on your regional settings. May 26, 2016 at 16:31
0

the formula should be like this:

=IF([Column]="<string>", "<string>", "<string>")

I tested your formula in my O365 tenant (copy pasted from your post) and it works with no issue. Can you please check if you mispelled something? the other thought is that the data type you are using is not a single line of text.

Your Answer

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

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