1

I need help writing an IF statement for a SP calculated column. I have it working right now to display the green indicator, but need to add the clauses for it to display the yellow and red indicators as well.

="<DIV><imgsrc='"&IF(Colour="Green","/_layouts/images/KPIDefault-0.GIF","/_layouts/images/KPIDefault-2.GIF")&"'></DIV>"

The first section (green status) is what is working, the rest needs modification I know. Basically I want to add :

IF Colour="Red" then display "/_layouts/images/KPIDefault-2.GIF"

IF Colour="Yellow" then display "/_layouts/images/KPIDefault-1.GIF"

PLEASE help :)

1 Answer 1

1

Just keep nesting the if statements,

="<DIV><imgsrc='"&IF(Colour="Green","/_layouts/images/KPIDefault-0.GIF",&IF(Colour="Red","/_layouts/images/KPIDefault-2.GIF",&IF(Colour="Yellow","/_layouts/images/KPIDefault-1.GIF")))&"'></DIV>"

The syntax above might not be perfect, but you should get the idea

4
  • What is wrong with my syntax, i am getting errors? ="<DIV><img src='"&IF(Colour="Green","/_layouts/images/KPIDefault-0.GIF"),"&IF(Colour="Yellow","/_layouts/images/KPIDefault-1.GIF"),"&IF(Colour="Red","/_layouts/images/KPIDefault-2.GIF")&"'></DIV>"
    – dave
    Commented Jan 22, 2014 at 16:37
  • Hurray, I got it, thanks to you and this other thread : sharepoint.stackexchange.com/questions/36237/…. Thank you therefore to Trisha and Ryan as well.
    – dave
    Commented Jan 22, 2014 at 16:44
  • ="<DIV><img src='"&IF(Colour="Green","/_layouts/images/KPIDefault-0.GIF",IF(Colour="Yellow","/_layouts/images/KPIDefault-1.GIF",IF(Colour="Red","/_layouts/images/KPIDefault-2.GIF")))&"'></DIV>"
    – dave
    Commented Jan 22, 2014 at 16:44
  • I am not sure but have a look here link
    – Dovahkiin
    Commented Jan 22, 2014 at 16:47

Your Answer

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

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