HTML Calculated Column Example Uses - Traffic Light

A traffic light column is a great addition to any list; it allows you to quickly recognise high priority tasks.

Christophe at Path To SharePoint came up with an elegant way to easily display traffic lights on your list, without the need for icons or similar. We can use his calculated column formula in HTMLCC, without having to worry about the JavaScript side of things:

=”<DIV style=’font-weight:bold; font-size:24px; color:”&CHOOSE(RIGHT(LEFT([Priority],2),1),”red”,”orange”,”green”)&”;’>&bull;</DIV>”

However, this may throw an error in certain circumstances (e.g. blank entries, fill-in values), so here is a slightly more robust version:

=IF(ISERR(RIGHT(LEFT([Priority],2),1)-1),"","<DIV style='font-weight:bold; font-size:24px; color:"&CHOOSE(RIGHT(LEFT([Priority],2),1),"red","orange","green")&";'>&bull;</DIV>")

Simply copy and paste in the HTMLCC formula box, and you're done!