Question

I am using SharePoint 2010.

I added a new Column and made it a Calculated Column.

Now I need to place a CASE statement in my Formula. Something like this...

CASE when [Region1] = 'A' and [Region2] = 'B' THEN
     'NO'
     when [Region1] = 'C' and [Region2] = 'D' THEN
     'YES'
     else
     'N/A'
END

So the value of my Calculated Column will be either YES or NO

Was it helpful?

Solution

Rewrite your formula with if-statements and nest them, something like this:

=if(AND([Region1]="A",[Region2]="B"),"NO",if(AND([Region1]="C",[Region2]="D"),"YES","N/A"))

The first if does the first test, if that statement doesn't hold: use the second if (nested in the first if).

OTHER TIPS

You'll want to use IF statements, look at this MSDN article or this Office document for references. It also helps to mock it up in Excel and then copy/paste it into the calculated column.

Edit: just about had it figured out and Dribble beat me to the formula, nested Ifs which can go up to 7 deep.

The equivalent of CASE in SharePoint is CHOOSE, but it is not very flexible (you need to resort to tricks to convert your cases into numbers). Usually nested ifs work better.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top