This post is a followup to my previous blog post titled, Creating a Stoplight Color Coded Status in a SharePoint List, which was a tutorial using SharePoint 2010. I have been getting a lot of comments on how to create a stoplight color coded status in SharePoint 2013, so I thought I would create a tutorial about it. Obviously a lot has changed between the two versions of SharePoint including the look and feel. I hope you find this updated tutorial useful!
We will use the following status codes:
- Green = Project is on track
- Orange = Project is starting to fall behind
- Red = Project is behind
- Purple = Project is on hold
Important Note: For the calculated field to work, you will need to make sure that your Status field contains a number, because we will base the color selected on this number.
- Navigate to Site Settings -> Site Libraries and Lists.
- Click the Create new content link.
- Click the add an App icon.
- Select the Custom List icon.
- Type in the name of your new list ‘Project Status Report‘ and click the Create button.
- Navigate to your new list and click on the edit this list link.
- Rename the first column Project, and click the plus sign to add a Text column named Status.
- Click the plus sign again to add a new column and click More Column Types.
- Type in the Column Name Stoplight and select the Calculated column type.
- Enter in the following Formula and click the OK button.
Note: that the formula is selecting the 1st character of the value in the Status Column “LEFT(Status,1)“. If the number in your status field is in a different location you may have to adjust the formula a little to get the correct result. The number in the status column is then used in the CHOOSE() function to determine which color should be used. In our example if the number is 1 then it will be green, if the number is 2 the color will be orange and so on.
XHTML1="<DIV style='font-weight:bold; font-size:24px; color:"&CHOOSE(LEFT(Status,1),"green","orange","red","purple")&";'>•</DIV>"
- Enter in some data into the Project and Status fields like the following example:
- Go back to your Project Status Report and navigate to Site Settings -> Edit Page.
- Click on the Add a Web Part link.
- Select Media Category, Content Editor Web Part and click the Add button.
- Move the Content Editor Web Part below your Project Status Report list.
- Click the the arrow on the top right of the Content Editor Web Part and click Edit Web Part.
- Paste in your link to the .txt file you uploaded in step 12 into the Content Link textbox and click Apply.
Note: You will notice that after clicking apply, your stoplight column still displays code. We have one thing that we need to do to adjust the view of our list.
- Click on the arrow next to your Project Status Report List and click Edit Web Part.
- On the Edit Web Part, List View options click Edit the Current View.
- Reorder the List View columns and put the Stoplight column first.
- Scroll down to the Style options and change the View Style from Default to Basic Table and click the OK button.