A progress bar for your tasks list

Today, let’s see how to show the progress of your tasks in SharePoint:

 

We’ll rely on this method: using calculated columns to write HTML. Easy, and entirely done through the SharePoint UI.

The [% Complete] is a default column in tasks lists. We just need to add – in a calculated column – the formulas for this specific use case. Here they are:

– Progress Bar:
=”<DIV style=’background-color:blue; width:”&([% Complete]*100)&”%;’>&nbsp;</DIV>”

– Progress Bar 2:
=”<DIV style=’background-color:red;’><DIV style=’background-color:LimeGreen; width:”&([% Complete]*100)&”%;’>&nbsp;</DIV></DIV>”

Note: the &nbsp; character is mandatory to make this work in Firefox.

If you are looking for other colors, here is a very good reference:
http://www.w3schools.com/html/html_colornames.asp

45 thoughts on “A progress bar for your tasks list

  1. Have just found your blog through EndUserSharepoint.com. Some really good, unique content you have here. Thanks for sharing and please keep it up!

    Thanks,
    Greg

  2. Just tried to copy and paste the HTML of both progress bars into a calculated column, and what I get displayed is just the formula, and not the progress bar as it shows above. Am I missing something here?

  3. Erich: the formulas themselves do nothing, as you have experienced. You have to add the script (see the reference to the method in the above article).
    On this site I have several articles like this one, where I just point to the original article where the script is published.

  4. Pingback: Another example of progress bar « Path to SharePoint

  5. How can I do conditional red, yellow & green coloring? Can’t I just do a nested IF statement?

    I’m trying to figure out the syntax, but I’m stumped. I’d like the bar to move and change color, all based on the value of the % Complete column.

  6. Owen: as this topic is very popular, I am going to publish a third article on progress bars. I’ll include your use case.
    There are various ways to apply conditional formatting. Using nested IF statements is the standard way. When applicable, I prefer the CHOOSE function which is lighter. Sometimes, you can also use math formulas as a workaround.

    I suggest that you check out the following posts (the first one uses the CHOOSE function):
    https://pathtosharepoint.wordpress.com/2008/09/01/apply-color-coding-to-your-sharepoint-lists/
    https://pathtosharepoint.wordpress.com/2008/09/29/another-example-of-progress-bar/

  7. Pingback: Coming soon: more examples of progress bars « Path to SharePoint

  8. Pingback: Progress bar + color coding « Path to SharePoint

  9. Pingback: The “HTML calculated column”: stay tuned! « Path to SharePoint

  10. Christophe,

    How can I get the percent complete in sub-tasks of a major task? Basically, I have “Issue A” and there are 10 sub-tasks. If seven sub-tasks are complete, resulting in “Issue A” being 70% complete – how do I “roll-up” that percentage and then use the calculated columns above to display overall status of “Issue A”.

    I’m guessing another calculated column?

    Thanks,
    Brian

  11. Brian, how do you build the task hierarchy in your list?
    SharePoint works by entry (row), and calculated columns won’t allow cross-row calculations.

  12. Hi Christophe

    Your article on progress bars for tasks list was exactly what I was looking for – thanks.

    However, I have added your script to the source editor of a new content editor web part on the same web page as the list; and your html to a new calculated column Progress, and it does not work.

    The Progress column displays as follows:

    % Complete Progress
    10%
    40%
    100%

    I am using the Project Task list template.

    Any suggestions?
    Thanks in advance
    Jeff

  13. Hi christophe

    Have checked the formula – retyped etc and also read through /tried all the potential fixes in the trouble shooting.

    I also tried a different (but similar solution) from someone else: http://blog.ray1.net/2008/01/enabling-html-andor-images-in.html

    But no success, the formula runs (i.e. calculates the width % from the % Complete) but does not generate the html, only shows the html code as written in the formula.

    Do you think it is because of permissions on Project Tasks lists? the Sharepoint features?

    I really have no idea why it is not running. Any help would be greatly appreciated

    Jeff

  14. Perfect :-). btw this is mentioned in the troubleshooting page.

    I just discover the above post, and the idea is very similar to mine, except that it’s done on the server side. I don’t know how reliable it is – one of the comments reports an issue.

    My blog is mainly for people who don’t have access to the server, and for whom that method is not an option.

  15. Thanks for the help – some great stuff you have done. Looking into your events stuff now – really impressed.

    You wouldn’t know anything about summarizing items in a list would you?

    e.g. recreate “dashboard” on change request management template (under project management section).

    i.e. Can you create a calculated field in one list that summarizes the records from another list?

    I am guessing that since you can link multiple lists by lookup, you should be able to summarise them?

  16. Hi,

    I tried the above but instead of the progress bar, it displays the html text in the column.

    Should i do some other setting?

    Thanks

  17. Pingback: Online Workshop – Easy Tabs for Project Dashboard « Path to SharePoint

  18. Pingback: SharePoint Wednesday CodePlex Roundup #2 - Fear and Loathing

  19. Pingback: SharePoint Wednesday CodePlex Roundup #2 | I love .NET!

  20. Pingback: HTML Calculated Column and Unicode Graphics « Path to SharePoint

  21. Thanks for the progress bars. I have one issue, when we try to print the page that has the progress bar, it does not display. Any thoughts?

    • By default printers don’t print background colors, so this is the expected behavior.

      One option is to change your printer settings. Or search my blog for other examples of progress bars, including a printable version.

  22. Pingback: Case study: course compliance report (Part II) « Path to SharePoint

  23. I already developed a webpart by using SPGridView.
    Now I want to make that web part as CEWP, so that I can put one column as progressbar. Please suggest me

  24. I have huge list containg tasks to do and their status sorted by subgroup.
    e.g.
    Subgroup Task Status
    A Imp. Doc Completed
    A Test In Progress
    ….
    B Build a house NotStarted

    I would like to create an overview which gives an overview about the progress for each subgroup and if it is possible in a coloured way or visualized.

    Completed In Progress NotStarted Total
    Subgroup A 2 4 5 11
    Subgroup B 4 2 0 6
    ..
    ..
    ..
    Do you have an idea how i can manage this in Sharepoint?
    Thanks.

  25. On Progress Bar 2: there is always a little green part on the left end even when %Complete value is 0! How can I fix that.

    • Right, this is because the bar contains at least a space. To avoid this, you would need to include in the formula a condition that completely removes the bar when % Complete = 0.

  26. I am very happy to found this article. I change the approach a bit then everything is working for me.
    approach is:
    create a calculate column, then put such code, then it computes starts:

    =IF(RatePerformance=”2″,”**”,(if([RatePerformance]=”1″,”*”,(if([RatePerformance]=”3″,”***”,(if([RatePerformance]=”4″,”****”,(if([RatePerformance]=”5″,”*****”)))))))))

  27. Hi all, I have a custom list which I have made the above work with as long as I manually type in the ‘% complete’ into each item as the sale progresses. What I wanted to do was run a workflow from SPD to update the % complete box based on a sales stage, triggered when a item is created or changed. It works the first time I run the WF (compares field, then updates % field in current item, with various additional ‘else if conditions set up for each sales stage, updating the % field). – this could be completely the wrong approach, so please advise. It all falls over when the sales stage is changed, giving an error message, something like ‘the changes made conflict with changes made by a current user’

    Any help appreciated as I am hoping this is common or obvious to someone with a brain

    Thanks, Ben

  28. when i posted your formula in calculation based column formula it shows only in task list view. no blue color visible. i think i have to add a cewp in that page and a script to show color .. i could not found that script. please give me link the script that will work on this post.

  29. If I modify the view and add ‘group by’, the progress bars show the formula and not the colors.
    eg. Lets say Tasks 1,2,3 are in “Stage1” Tasks 4,5,7 in “Stage 2”. When I group by “Stage” I cannot see the colors.
    I am guessing it has to do with the script.
    Any help appreciated.

    Thanks,
    -Deepti

    • This is one of my oldest post… Read through the blog and you’ll find more recent versions that work in your case, for both SP 2007 and SP 2010.

  30. Pingback: A progress bar for your tasks list « AmitP Tech Blog

  31. This very nice, thank you! Stumped until I put DWP below my data view. Is there a way to stack more than 2 colors? So less of a progress bar than a timeline?

  32. I have Sharepoint 2007 and it not work for my. I create a new List, add a column type number and check the View as percentage, add a column Calculated. Enter the value Title, (20%) in the field numeric and Progress Bar 1 example in the Calculate field. The item show the value and the text script. I Edit the page, add the Web Part Editor Content and paste the Script in the Source code editor, when close the edition mode, this no read the script in the calculated field.
    Some help, please.

Comments are closed.