Calculating the Number of Workdays between Two Dates

  • Last update:  2023-09-28
  • Overview

    Preview

    You may need to calculate the number of workdays between the start time and the end time.

    1.png

    Implementation Method

    The number of workdays between two dates is calculated by subtracting the marked number of these two dates.

    Procedure

    Download sample data: Sample Data.zip

    Processing Date Table

    1. The content format of the Date Table is shown in the following figure.

    If your holiday arrangement is different from the table, you can modify it.

    2.png

    2. Create an analysis subject named Number of Workdays Between Two Dates, upload the Date Table, and rename it to Holiday Marked Table.

    5.png

    3. Add a formula column to mark holidays as 0 and non-holidays as 1.

    6.png

    4. Add a Summary Column to accumulate the values of the 0/1 Marking field in ascending order by Date.

    7.png

    The result is shown in the following figure. The Mark Number field can be used to calculate the number of workdays between two dates.

    For example, to calculate the number of workdays between 2011/03/14 and 2011/03/08, you can subtract the corresponding mark numbers and add 1: (45 - 41) + 1 = 5 days.

    Special case: To calculate the number of workdays between 2011/03/09 and 2011/03/05 (the start date is a holiday), you can simply subtract the corresponding mark numbers: 42 - 39 = 3 days.

    8.png

    Calculating the Number of Workdays

    1. Upload the Personnel Table with all fields selected by default. 

    9.png

    2. Click Join. Select the fields Date, Holiday or Not, and Mark Number in the Holiday Marked Table and choose Start Time and Date as Merge Basis, as shown in the following figure.

    10.png

    By doing so, you mark the Start Time field in the Personnel Table with numbers and determine whether the Start Time is a holiday.

    3. Click Field Settings. Rename the Mark Number field to Mark Number of Start Time and the Holiday or Not field to Whether Start Time is Holiday.

    11.png

    4. Click Join. Select the fields Date and Mark Number in the Holiday Marked Table and choose End Time and Date as Merge Basis, as shown in the following figure.

    By doing so, you match the End Time field with the Mark Number field.

    12.png

    5. Click Field Settings and rename the Mark Number field to Mark Number of End Time.

    6. Add a Formula Column to calculate the number of workdays between the Start Time and the End Time, as shown in the following figure. /

    • If the Start Time is a holiday, enter the formula: IF(Whether Start Time is Holiday="Holiday", Mark Number of End Time-Mark Number of Start Time, Mark Number of End Time-Mark Number of Start Time)

    • If the End Time is a holiday, enter the formula: IF(Whether Start Time is Holiday="Holiday", Mark Number of End Time-Mark Number of Start Time, Mark Number of End Time-Mark Number of Start Time+1)

    13.png

    Click Save All and Update.

    Demonstration

    The result is shown in the following figure. According to this figure, James worked for 43 days from 2016/07/04 to 2016/08/31.

    14.png


    附件列表


    主题: Adding and Editing Data
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy