none
Need a formula to make % completed column to be 100% when Status changed to Complete RRS feed

  • Question

  • Hello

    Does anyone know of a formula that I can put in either the status column (started, not started, etc) or % Complete column so that when the status column is changed to "Complete", it automatically changes % complete to 100?

    This is really for Sharepoint 2016 online

    Thanks

    Wednesday, January 16, 2019 12:58 PM

All replies

  • Hi,

    By default in the SharePoint Task list, the Task Status and % Complete are related, controlled by the code-behind.

    When saving a task item:

    • If you set the Task Status to Not Started, % Complete will be set to 0 automatically.
    • If you set the Task Status to Completed, % Complete will be set to 100 automatically.
    • If you set the Task Status to any other value, % Complete will be set to 50 automatically.
    • If you set the % Complete to 0, the Task Status will be set to Not Started automatically.
    • If you set the % Complete to 100, the Task Status will be set to Completed automatically.
    • If you set the % Complete to any other number (0< value < 100), the Task Status will be set to In Progress automatically.

    If you are using a custom list, you need to use JavaScript to set the value of % Complete to 100 when the Status is Completed.

    Here is a demo:

    <script src="https://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    
    <script language="javascript" type="text/javascript">
    
    function PreSaveItem(){
    
                    // get "Task Status" field value
    
                    var status=$("select[title='Task Status'] option:selected").text();               
    
                    if(status == "Completed"){
    
                                    $('input[title="% Complete"]').val(100);
    
                    }
    
                    return true;
    }
    </script>


    Best Regards,

    Linda


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, January 17, 2019 4:36 AM
    Moderator
  • Hi,

    Is there any update?

    If it helps you, please mark it as the answer.

    Best regards,

    Linda


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, January 23, 2019 9:17 AM
    Moderator