I would like to show status icon as a picture in my list in column called "ICON" in SharePoint 365. I am using calculated column to show the icon, a picture which is stored in the Site Assets library in SharePoint.

I followed several guidance, I am able to display one icon for all rows if I use following formula:

 ="<DIV><img src='https://tenant.sharepoint.com/sites/pwa/Premier%20Oil%20-%20Vendor%20Neutral%20Service/SiteAssets/227-rect_red.png'
 & IF([Overall Status]=(3) Red) '></DIV>"

But I cant work out how to display the right icon when selecting the Overall Status, which is either Green, Amber or Red, I am using following formula, but receiving errors.

 ="<DIV><img src='" & IF([Overall Status]=(3) Red, "https://tenant.sharepoint.com/sites/pwa/Premier%20Oil%20-%20Vendor%20Neutral%20Service/SiteAssets/227-rect_red.png",
 IF([Overall Status]=(2) Amber,
 IF([Overall Status]=(1) Green,
 & "'></DIV>"

Remember: Microsoft disabled HTML in Calculation Columns for SPOnline in june 2017

You missed a lot of quotes or used the wrong ones.

always edit Formulas in Notepad or another TextEditor and use plenty of linebreaks and tabs; they will be ignored when you paste/save the Formula in a SharePoint column.

I did not test this formula, could be typos left

="<IMG src='"
    &IF([Overall Status]="(3) Red"
        ,IF([Overall Status]="(2) Amber"
            ,IF([Overall Status]="(1) Green"
                , "228-rect_green.png"
    & "'>"

Note: To format code in a StackOverflow post use 4 spaces or the " button from the buttonbar when posting code/formulas in StackOverflow

More Formula help at: http://www.viewmaster365.com/365coach/#/Calculated_Column_Functions_List

  • Many thanks Danny, the formula works perfectly! Thanks – Helena Dec 16 '16 at 18:50
  • Don't forget... always work from a text-editor with Formulas. And mark questions answered so StackOverflow can rate correct answers. More Formula help at: viewmaster365.com/365coach/#/Calculated_Column_Functions_List – Danny '365CSI' Engelman Dec 16 '16 at 19:48
  • I tried this solution in SharePoint online today and it just shows the code right on the page, rather than rendering the picture. – Greg Viers Jul 19 '19 at 18:49
  • That's why the top of the message refers to Microsoft disabling it in 2017 – Danny '365CSI' Engelman Jul 19 '19 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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