Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm creating a list with some calculated fields from code that use IF expressions.

fieldCalc.Formula = "=IF([Field1]=0,[Field2],[Field3]&\" (\"&([Field4]/[Field5]*100)&\"%)\")";

Apparently, when used in a SharePoint enviroment with comma for decimal point (like Slovenian), the separators in IF expression must be changed to semicolon, like so:

fieldCalc.Formula = "=IF([Field1]=0;[Field2];[Field3]&\" (\"&([Field4]/[Field5]*100)&\"%)\")";

How do I know what separator to use in my expressions?

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

Formulas and functions depend on the language of your site. It's not just about commas vs. semi-colons, the function names will change too.

You can play with this example:

http://sp2010.pathtosharepoint.com/SharePoint-User-Toolkit/Pages/Color-Coding-Calendar-List.aspx

Change the language, and you'll see how it affects the formula. For example, "IF" will become "ALS" in Dutch.

My examples confirm your rule of thumb: if the comma serves as decimal point in numbers, then use a semi-colon.

share|improve this answer
add comment

Try using semi colons by default, i think it should work with them regardless of the language you select.

share|improve this answer
    
No, unfortunately it doesn't work. –  Luc Sep 13 '10 at 11:46
add comment

I think that you need first look the beheavior on the Column Setting.

Look this example on my list:

My native language on site is spanish.

=IF([Adherencia Metodologica Valor]="";" ";IF([Adherencia Metodologica Valor]<10;""&[Adherencia Metodologica Valor]&"%";IF([Adherencia Metodologica Valor]>9;""&[Adherencia Metodologica Valor]&"%";)))

I render the HTML content... but this is other thing :)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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