Thursday 20 October 2011

How to add if else if statement in calculated columns of SharePoint 2007

This is what I want to achieve

if(status = "Bad")
then rating = 1
else if(status = "Good")
then rating = 2
else if(status == "Excellent")
then rating = 3

to achieve this I created a calculated column "Rating" and added below formula

=IF([status]="Bad",1,IF([status]="Good",2,IF([status]="Excellent",3)))

And it was returning perfect results required to me.

There are also lots of sample formulas available at below link:
http://office.microsoft.com/en-us/sharepoint-server-help/CH010176029.aspx?CTT=97

2 comments:

  1. Thank you so much, its worked perfect

    ReplyDelete
  2. You can also do something like the following if you want to compare between a range of values:

    =IF([Annual Volume]<=100,1,IF(AND([Annual Volume]>100,[Annual Volume]<=500),2,IF(AND([Annual Volume]>500,[Annual Volume]<=1000),3,4)))

    The AND statement above allows for specification of a range, such as: 100 < annual volume <= 500.

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...