# Calculated column - using multiple AND and IF functions

I have been trying to figure this out and I cannot solve it.

I am trying to create something which say IF column a = "High" AND Column b ="High" THEN "Red" should be inputted. So far I have...

``````=IF(
([Column a]="High" AND([Column b]="High") )
,"Red"
, IF(
([column a]="High" AND([Column B]="Low") )
,Gold"
, IF(
([Column a]="Low" AND([Column b]="High") )
,"Green"
, IF(
([Column a]="Low" ( AND[Column b]="Low") )
,"Black"
, ("n/a")
)
)
)
)
``````

Thanks in advance

## 2 Answers

The formula will be something like this. I have not tested it, but it should work:

``````=IF(
AND([Column A]="High",[Column b]="High")
,"Red"
,IF(
AND([Column A]="High",[Column b]="Low")
,"Gold"
,IF(
AND([Column A]="Low",[Column b]="High")
,"Green"
,IF(
AND([Column A]="Low",[Column b]="Low")
,"Black"
,"NA"
)
)
)
)
``````

Reference: Calculated Column formulas

• IT WORKED!!!! Thank you so much!!! I killed my brain last night trying to work this out – Stephanie Sep 9 '15 at 22:30

Correct, contrary to programming languages, SharePoint has Logical Functions, not Operators.
Note: A SharePoint Function can (only) take up to 30 parameters..

More info on available Functions at: ViewMaster365/Functions

If status is always high/low you can condense your Formula to:

``````=IF(
[Column A]="High"
,IF([Column b]="High"
,"Red"
,"Gold"
)
,IF([Column b]="High"
,"Green"
,"Black"
)
)
``````

You can copy/paste Formula from here into SharePoint; on save SharePoint will remove all newlines and spaces

### Update #1

When you do want the NA option, rewrite it to a way better readable Formula:

``````=IF([Column A]&[Column b]="HighHigh"
,"Red"
,IF([Column A]&[Column b]="HighLow"
,"Gold"
,IF([Column A]&[Column b]="LowHigh"
,"Green"
,IF([Column A]&[Column b]="LowLow"
,"Black"
,"NA"
)
)
)
``````