Color Coding – Formula Generator

The number one application of the “HTML Calculated Column” method is color coding. This can be applied to SharePoint lists or calendars.

The tricky part is to get the formula right in the calculated column. I have already published step by step examples to help users get started. But as soon as users’ needs slightly differ from these examples it becomes difficult for occasional site designers to get it right.

In an attempt to make the method more accessible, I have built a Formula Generator. Fill out the form with your choice list and the associated colors, select one pattern (Background/Font color/Traffic light), and the Formula Generator will build the formula for you. Hopefully this will allow more users to benefit from the HTML Calculated Column.

I plan to build other formula generators in the future to accomodate other needs (progress bars, etc.). Spread the word!

Update [April 23rd, 2009] Based on readers’ feedback, I have added a formula generator for numeric values.

24 thoughts on “Color Coding – Formula Generator

  1. Pingback: SharePoint Calculated Column formula generator | End User SharePoint

  2. This is a great tool, but I just can’t seem to make it work on my site.
    I chose to add color to the background of the title but when I view the calendar item I see: TEST
    instead of just a yellow background behind the title, TEST.

    I read thru all of the related posts, and there are smal tweaks that folks suggest, including inserting the brackets ([Title]), but I haven’t felt the love yet.

    Any help is appreciated.


  3. Thank you very much for this. Is there a way color coding can be accomplished inside of a SPD DataFormWebPart?



  4. Mark: you can certainly make it work on Data Form Web Parts. However, once you are in SharePoint Designer the natural way to do color coding is to use the conditional formatting options.

  5. What are the chances of creating a generator that will incorporate images rather than color coding?

  6. I hit submit too quickly before… Just wanted to say that your efforts here are truly appreciated by me and many of my colleagues who use your site as a necessary reference. Thanks from all of us!

  7. The issue with images is that you first need to define a set of images and their location. It could easily be done for a specific company or team, but not as a generic solution.

  8. Hey Christophe, it’s been a while. hope you enjoyed that traveling you mentioned. I see many uses for this, one issue I keep running into is modifying this. Instead of background color, additional background attribiutes. Is there a way to apply a css class instead of a style? Easier to manage the css then trying to manipulate the formula.

    thanks again

  9. Christophe,
    First I want to thank you for all yuour posts. You have truely helped me a great deal with building out my sites for our customer. One issue I am having with this particular thing is the ability to print the color coding. Whenever I go to print the site for say a pdf or for a meeting it does not render the color just the text in the fields. Is there a way to get the color coding to appear with the text? Again thanksagain for everything and any help on this issue would be greatly appreciated.

  10. is there a way to combine formulas for KPI Default indicators and traffic lights in one calculated column – I want to be able to assign KPI default indicators for status (complete, in progress, on hold) and then a colored traffic light for status (planned, not planned). I can’t figure out to nest the different formulas together.

  11. Chris,

    Is there an easy way to add colour formating to a column that is populated with dates? And note that there is no specific formula for the colours, in our case, we would have date fields, and want to be able to change the colours of certain dates.

    I drilled through your site to see if I could find an example, and all I could find was changing colours based on pre-set fields (i.e. choices)


    • Byron, you can use date and numbers in the formulas. I may not have an example that addresses your exact need, but you can search my blog for “countdown”, and for “progress bar” (shows how a number can be used to format fields).

  12. Please help me with this:

    =”=”9″;”Red”;IF(([Riska pakāpe])=”8″;”Yellow”;IF(([Riska pakāpe])=”6″;”Yellow”;IF(([Riska pakāpe])=”5″;”Yellow”;IF(([Riska pakāpe])=”4″;”Yellow”;IF(([Riska pakāpe]) “&([Riska pakāpe])&””

    But it`s all green now 😦

  13. Sorry – here`s the code
    IF(([Riska pakāpe])>=”9″;”Red”;IF(([Riska pakāpe])=”8″;”Yellow”;IF(([Riska pakāpe])=”6″;”Yellow”;IF(([Riska pakāpe])=”5″;”Yellow”;IF(([Riska pakāpe])=”4″;”Yellow”;IF(([Riska pakāpe]) “&([Riska pakāpe])

  14. Found workarround: =IF(([Riska pakape]*3/25)>=2;”RED”;IF(([Riska pakape]*3/25<=1);"GREEN";"YELLOW"))

Comments are closed.