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

About these ads
    • Greg O
    • September 2nd, 2008

    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

    • Erich
    • September 18th, 2008

    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?

    • Christophe
    • September 18th, 2008

    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.

    • Owen
    • October 15th, 2008

    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.

    • Christophe
    • October 16th, 2008

    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):
    http://pathtosharepoint.wordpress.com/2008/09/01/apply-color-coding-to-your-sharepoint-lists/
    http://pathtosharepoint.wordpress.com/2008/09/29/another-example-of-progress-bar/

    • Brian Merrifield
    • January 16th, 2009

    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

  1. 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.

    • Jeff
    • March 30th, 2009

    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

  2. Jeff: first double check your formula (do not copy/paste directly from my post because of text formatting issues), and see if this troubleshooting page helps:
    http://pathtosharepoint.wordpress.com/2008/11/01/troubleshooting-your-html-calculated-column/

    • Jeff
    • March 30th, 2009

    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

  3. Jeff: send me your formula, and a screenshot of your page in edit mode:
    Christophe@PathToSharePoint.com

    • Jeff
    • March 30th, 2009

    No worries – have found the error – positioning of content editor web part on page.

    Doesn’t work if not below list.

    Had it above / to the side etc. Thanks for script and help.

    Do you think it would be better to use: http://blog.ray1.net/2008/01/enabling-html-andor-images-in.html

    and change the xml file?
    Jeff

  4. 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.

    • Jeff
    • March 30th, 2009

    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?

    • Neeta
    • June 24th, 2009

    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

    • Samuel
    • April 22nd, 2010

    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.

    • Kishore
    • May 14th, 2010

    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

    • Daniela
    • July 16th, 2010

    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.

    • Anonymous
    • October 10th, 2011

    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.

    • Anonymous
    • October 21st, 2011

    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″,”*****”)))))))))

      • Anonymous
      • October 21st, 2011

      it works for SP 2010

    • Ben McLaughlin
    • November 24th, 2011

    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

    • Ben, this is obviously not linked to my code. Maybe try to post your question in a forum, like SharePoint on Stackexchange for example.

    • ktran
    • January 21st, 2012

    Thank you so much. Easy to use!

    • Ankit Sharma
    • February 15th, 2012

    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.

    • Deepti
    • April 2nd, 2012

    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.

    • Kai Lubbe
    • December 13th, 2012

    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?

    • Sure! Search my blog for Gantt and you’ll find an example of this same technique used with dates. This should be a good starting point.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 261 other followers

%d bloggers like this: