Browse All Articles > Distribute Hours Evenly Between Two Dates

Recently I have answered a question on how to distribute hours evenly between two dates. I thought this isn't that difficult to do that in Excel with formula, but what I see from this question, it could be applied to other similar scenarios. So, let's try and see what could we do here.

The original question is pretty straight forward with the statement below:

Below is what the asker provided.

From the table above, the initial observations are:

1) The date range from the start date to finish date consists of 15 days (both mutually inclusive)

2) The total hours is 1600, if it's divided evenly between the start and finish dates, it would be 1600/ 15 = 106.67 (rounded to 107) per day.

So, now let's solve the original question in which we need to apply the following rules:

1) Exclude Sundays in the calculation. Meaning to say, when it's Sundays, there will be 0 hour on that day.

2) Half workday for Saturdays.

**The steps**

**1) Calculate the number of working days between the start and finish dates**

To do that, from the date range, we are using the formula: NETWORKDAYS.INTL

The formula could be like this:

We could refer to the table below for the 3rd parameter to be used in NETWORKDAYS.INTL function.

We passed 11 as 3rd parameter to the formula to exclude the calculation for Sundays.

From the calculation above, you should get a result of 13. Meaning to say, there is 13 working days between 16 Dec to 30 Dec, consider that Sundays are off days.

**2) Saturdays are half days**

As per the requirement, the smaller unit of working is "half day", so for a full day, there will be 2 "half days".

**3) Calculate how many Saturdays within the date range**

To do that, we could use the formula:

So, technically, if there are 2 Saturdays between the date range, we would need to minor off these 2 units of "half days" since it's not working.

**4) Calculate total units of working**

Since we have already gotten 13 working days, then it would be 13 x 2 = 26 working "half days". Finally, we need to minor off the 2 units of "half days" for Saturdays.

Hence, the total units of working between the date range is (13 x 2) - 2 = 24

**5) Total man-hours and average per unit**

Based on what is given, the total man-hours is 1600 hours. Then, we have total units of "half days", which is equal to 24.

To summarize:

Man hours per unit would be 1600 / 24 = 66.67 hours

And this could be calculated based on the formula below:

**6) Distribute the man-hours per unit to each day**

Finally, we are checking the respective dates, and there are a couple of things to verify.

* If it's Saturday, it will take one man-hours per unit, which is 66.67 hours.

* If it's Sunday, it's off day, so the calculation will be zero.

* If it's other days, it will take two man-hours per unit, which is 66.67 hours x 2 = 133.33 hours.

To determine a weekday of date, we are using WeekDay function.

For example:

=WEEKDAY(D$1)

This function returns the day of the week corresponding to a date. The day is given as an integer, ranging from 1 (Sunday) to 7 (Saturday), by default.

We could use the formula below for a clearer illustration on working days:

The result would be:

To calculate for Saturdays, we simply re-use the formula at step 5 (since Saturdays got the smallest unit of working day):

To calculate for Sundays, we need 2 units of "half days", so we use the formula above x 2:

Finally, we need to put this formula into the conditions, and make the final formula like this:

Once, this is done, we could test the results:

The result is verified to be correct. The total sum of the hours is equal to 1600 hours.

**What's next?**

The asker has actually asked further in the actual scenario:

Let's try if we could make this!

a) For 2021 model: Mon-Sat full day; Sundays off day

We could use this formula:

b) For 2022 model: Mon-Sat full day; Sundays off day

We could use this formula:

Note: We will not use the formula: NETWORKDAYS.INTL in this case since all days are working days (weekdays and weekends).

c) Combine both 2021 and 2022 models together

We could use this formula:

Well, the formula getting more complex but it still produces the correct results.

Note: This formula does not work if it's within the same year. And it doesn't really cover more complex scenarios such as cross to the 3rd year calculations. If such scenarios happened, it's always better to use some helper formula instead of applying a single complex formula for the ease of maintenance and troubleshooting.

Hope you enjoy this tutorial, attached the Excel file for your references.

Sample.xlsx

I need to distribute hours evenly between start and finish dates excluding Sunday, considering working days from Monday - Saturday (Saturday half day work). Hours to be distributed evenly from Monday-Saturday.

Below is what the asker provided.

Start Date | Finish Date | MHRs | 16-Dec-20 | 17-Dec-20 | 18-Dec-20 | 19-Dec-20 | 20-Dec-20 | 21-Dec-20 | 22-Dec-20 | 23-Dec-20 | 24-Dec-20 | 25-Dec-20 | 26-Dec-20 | 27-Dec-20 | 28-Dec-20 | 29-Dec-20 | 30-Dec-20 |

16/12/2020 | 30/12/2020 | 1600 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 |

From the table above, the initial observations are:

1) The date range from the start date to finish date consists of 15 days (both mutually inclusive)

2) The total hours is 1600, if it's divided evenly between the start and finish dates, it would be 1600/ 15 = 106.67 (rounded to 107) per day.

So, now let's solve the original question in which we need to apply the following rules:

1) Exclude Sundays in the calculation. Meaning to say, when it's Sundays, there will be 0 hour on that day.

2) Half workday for Saturdays.

To do that, from the date range, we are using the formula: NETWORKDAYS.INTL

The formula could be like this:

=NETWORKDAYS.INTL($A$2,$B$2,11)

We could refer to the table below for the 3rd parameter to be used in NETWORKDAYS.INTL function.

Weekend number | Weekend days |
---|---|

1 or omitted | Saturday, Sunday |

2 | Sunday, Monday |

3 | Monday, Tuesday |

4 | Tuesday, Wednesday |

5 | Wednesday, Thursday |

6 | Thursday, Friday |

7 | Friday, Saturday |

11 | Sunday only |

12 | Monday only |

13 | Tuesday only |

14 | Wednesday only |

15 | Thursday only |

16 | Friday only |

17 | Saturday only |

We passed 11 as 3rd parameter to the formula to exclude the calculation for Sundays.

From the calculation above, you should get a result of 13. Meaning to say, there is 13 working days between 16 Dec to 30 Dec, consider that Sundays are off days.

As per the requirement, the smaller unit of working is "half day", so for a full day, there will be 2 "half days".

To do that, we could use the formula:

=INT((WEEKDAY($A$2-7)-$A$2+$B$2)/7)

So, technically, if there are 2 Saturdays between the date range, we would need to minor off these 2 units of "half days" since it's not working.

Since we have already gotten 13 working days, then it would be 13 x 2 = 26 working "half days". Finally, we need to minor off the 2 units of "half days" for Saturdays.

Hence, the total units of working between the date range is (13 x 2) - 2 = 24

Based on what is given, the total man-hours is 1600 hours. Then, we have total units of "half days", which is equal to 24.

To summarize:

Man hours per unit would be 1600 / 24 = 66.67 hours

And this could be calculated based on the formula below:

=$C$2/((NETWORKDAYS.INTL($A$2,$B$2,11)*2)-INT((WEEKDAY($A$2 - 7)-$A$2+$B$2)/7))

Finally, we are checking the respective dates, and there are a couple of things to verify.

* If it's Saturday, it will take one man-hours per unit, which is 66.67 hours.

* If it's Sunday, it's off day, so the calculation will be zero.

* If it's other days, it will take two man-hours per unit, which is 66.67 hours x 2 = 133.33 hours.

To determine a weekday of date, we are using WeekDay function.

For example:

=WEEKDAY(D$1)

This function returns the day of the week corresponding to a date. The day is given as an integer, ranging from 1 (Sunday) to 7 (Saturday), by default.

We could use the formula below for a clearer illustration on working days:

=IF(WEEKDAY(D$1)=1,"Off", IF(WEEKDAY(D$1)=7,"Half", "Working"))

The result would be:

Start Date | Finish Date | MHRs | 16-Dec-20 | 17-Dec-20 | 18-Dec-20 | 19-Dec-20 | 20-Dec-20 | 21-Dec-20 | 22-Dec-20 | 23-Dec-20 | 24-Dec-20 | 25-Dec-20 | 26-Dec-20 | 27-Dec-20 | 28-Dec-20 | 29-Dec-20 | 30-Dec-20 |

16/12/2020 | 30/12/2020 | 1600 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 |

Working | Working | Working | Half | Off | Working | Working | Working | Working | Working | Half | Off | Working | Working | Working |

To calculate for Saturdays, we simply re-use the formula at step 5 (since Saturdays got the smallest unit of working day):

=$C$2/((NETWORKDAYS.INTL($A$2,$B$2,11)*2)-INT((WEEKDAY($A$2 - 7)-$A$2+$B$2)/7))

To calculate for Sundays, we need 2 units of "half days", so we use the formula above x 2:

=2*$C$2/((NETWORKDAYS.INTL($A$2,$B$2,11)*2)-INT((WEEKDAY($A$2 - 7)-$A$2+$B$2)/7))

Finally, we need to put this formula into the conditions, and make the final formula like this:

=IF(WEEKDAY(D$1)=1,0, IF(WEEKDAY(D$1)=7,$C$2/((NETWORKDAYS.INTL($A$2,$B$2,11)*2)-INT((WEEKDAY($A$2 - 7)-$A$2+$B$2)/7)), 2*$C$2/((NETWORKDAYS.INTL($A$2,$B$2,11)*2)-INT((WEEKDAY($A$2 - 7)-$A$2+$B$2)/7))))

Once, this is done, we could test the results:

Start Date | Finish Date | MHRs | 16-Dec-20 | 17-Dec-20 | 18-Dec-20 | 19-Dec-20 | 20-Dec-20 | 21-Dec-20 | 22-Dec-20 | 23-Dec-20 | 24-Dec-20 | 25-Dec-20 | 26-Dec-20 | 27-Dec-20 | 28-Dec-20 | 29-Dec-20 | 30-Dec-20 | Total |

16/12/2020 | 30/12/2020 | 1600 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | |

Working | Working | Working | Half | Off | Working | Working | Working | Working | Working | Half | Off | Working | Working | Working | ||||

133.33 | 133.33 | 133.33 | 66.67 | 0.00 | 133.33 | 133.33 | 133.33 | 133.33 | 133.33 | 66.67 | 0.00 | 133.33 | 133.33 | 133.33 | 1600.00 |

The result is verified to be correct. The total sum of the hours is equal to 1600 hours.

The asker has actually asked further in the actual scenario:

How would be done by Year in one formula to destitute over the period of 2021-2022;

Lets say in 2021 we work as Mon-Saturday full day - Sunday off day and on 2022 we do Mon-Saturday full day - Sunday half day.

Let's try if we could make this!

a) For 2021 model: Mon-Sat full day; Sundays off day

We could use this formula:

=IF(WEEKDAY(D$1)=1,0,$C$2/((NETWORKDAYS.INTL($A$2,$B$2,11))))

Start Date | Finish Date | MHRs | 16-Dec-21 | 17-Dec-21 | 18-Dec-21 | 19-Dec-21 | 20-Dec-21 | 21-Dec-21 | 22-Dec-21 | 23-Dec-21 | 24-Dec-21 | 25-Dec-21 | 26-Dec-21 | 27-Dec-21 | 28-Dec-21 | 29-Dec-21 | 30-Dec-21 | Total |

16/12/2021 | 30/12/2021 | 1600 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | |

Working | Working | Working | Off | Working | Working | Working | Working | Working | Working | Off | Working | Working | Working | Working | ||||

123.08 | 123.08 | 123.08 | 0.00 | 123.08 | 123.08 | 123.08 | 123.08 | 123.08 | 123.08 | 0.00 | 123.08 | 123.08 | 123.08 | 123.08 | 1600.00 |

b) For 2022 model: Mon-Sat full day; Sundays off day

We could use this formula:

=IF(WEEKDAY(D$1)=1, $C$2/(((($B$2-$A$2+1)*2)-INT((WEEKDAY($A$2-1)-$A$2+$B$2)/7))), 2*$C$2/(((($B$2-$A$2+1)*2)-INT((WEEKDAY($A$2-1)-$A$2+$B$2)/7))))

Note: We will not use the formula: NETWORKDAYS.INTL in this case since all days are working days (weekdays and weekends).

Start Date | Finish Date | MHRs | 16-Dec-22 | 17-Dec-22 | 18-Dec-22 | 19-Dec-22 | 20-Dec-22 | 21-Dec-22 | 22-Dec-22 | 23-Dec-22 | 24-Dec-22 | 25-Dec-22 | 26-Dec-22 | 27-Dec-22 | 28-Dec-22 | 29-Dec-22 | 30-Dec-22 | Total |

16/12/2022 | 30/12/2022 | 1600 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | 107 | |

Working | Working | Half | Working | Working | Working | Working | Working | Working | Half | Working | Working | Working | Working | Working | ||||

114.29 | 114.29 | 57.14 | 114.29 | 114.29 | 114.29 | 114.29 | 114.29 | 114.29 | 57.14 | 114.29 | 114.29 | 114.29 | 114.29 | 114.29 | 1600.00 |

c) Combine both 2021 and 2022 models together

We could use this formula:

=IF(IF(YEAR(D$1)=2021, IF(WEEKDAY(D$1)=1,"Off", "Working"), IF(WEEKDAY(D$1)=1,"Half", "Working"))="Half", $C$2/IF(YEAR($B$2)=2022, (NETWORKDAYS.INTL($A$2,DATE(2021,12,31),11)+$B$2-DATE(2022,1,1)+1)*2 -(INT((WEEKDAY(DATE(2022,1,1) -1)-DATE(2022,1,1)+$B$2)/7))), IF(IF(YEAR(D$1)=2021, IF(WEEKDAY(D$1)=1,"Off", "Working"), IF(WEEKDAY(D$1)=1,"Half", "Working"))="Off", 0, $C$2/IF(YEAR($B$2)=2022, (NETWORKDAYS.INTL($A$2,DATE(2021,12,31),11)+$B$2-DATE(2022,1,1)+1)*2 -(INT((WEEKDAY(DATE(2022,1,1) -1)-DATE(2022,1,1)+$B$2)/7)))*2))

Well, the formula getting more complex but it still produces the correct results.

Start Date | Finish Date | MHRs | 16-Dec-21 | 17-Dec-21 | 18-Dec-21 | 19-Dec-21 | 20-Dec-21 | 21-Dec-21 | 22-Dec-21 | 23-Dec-21 | 24-Dec-21 | 25-Dec-21 | 26-Dec-21 | 27-Dec-21 | 28-Dec-21 | 29-Dec-21 | 30-Dec-21 | 31-Dec-21 | 1-Jan-22 | 2-Jan-22 | 3-Jan-22 | 4-Jan-22 | 5-Jan-22 | 6-Jan-22 | 7-Jan-22 | 8-Jan-22 | 9-Jan-22 | 10-Jan-22 | 11-Jan-22 | 12-Jan-22 | 13-Jan-22 | 14-Jan-22 | 15-Jan-22 | 16-Jan-22 | Total |

16/12/2021 | 16/1/2022 | 1600 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | 50 | |

Working | Working | Working | Off | Working | Working | Working | Working | Working | Working | Off | Working | Working | Working | Working | Working | Working | Half | Working | Working | Working | Working | Working | Working | Half | Working | Working | Working | Working | Working | Working | Half | ||||

56.14 | 56.14 | 56.14 | 0.00 | 56.14 | 56.14 | 56.14 | 56.14 | 56.14 | 56.14 | 0.00 | 56.14 | 56.14 | 56.14 | 56.14 | 56.14 | 56.14 | 28.07 | 56.14 | 56.14 | 56.14 | 56.14 | 56.14 | 56.14 | 28.07 | 56.14 | 56.14 | 56.14 | 56.14 | 56.14 | 56.14 | 28.07 | 1600.00 |

Note: This formula does not work if it's within the same year. And it doesn't really cover more complex scenarios such as cross to the 3rd year calculations. If such scenarios happened, it's always better to use some helper formula instead of applying a single complex formula for the ease of maintenance and troubleshooting.

Hope you enjoy this tutorial, attached the Excel file for your references.

Sample.xlsx

Get access with a 7-day free trial.

SIGN UP

Not ready to sign up? Try a week for free to see if you belong

## Comments (0)