+ Reply to Thread
Results 1 to 10 of 10

Calculate netdays based on hours per week

  1. #1
    Registered User
    Join Date
    09-01-2019
    Location
    Belgium
    MS-Off Ver
    Excel 2013
    Posts
    5

    Calculate netdays based on hours per week

    Hello all,

    I am trying to calculate the rent of shipping containers based on hours per x workdays per week. See attached file and/or screenshot for 2 examples.

    The first week of May 2019 have 3 workdays, I can bill these 3 workdays (contract allows me to bill max 4 days per week).
    The other weeks in May have 5 workdays and I can bill max 4 workdays of each week.

    If I use the formula to calculate the net days, without the weekends and holidays, it will not give me the exact days.
    I thought by using the 'ceiling'. It will work for the first example, but not the second example.

    Probably there is a simple formula for this, but not seeing it at the moment. I hope my problem is described well, if not, don't hesitate to ask if you have any questions. Any help is much appreciated

    example.jpg
    Attached Files Attached Files

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Calculate netdays based on hours per week

    Please try at
    C13 Assume that Start and End not in the same week
    =SUM(MIN(4,6-WEEKDAY(C7,2)),MIN(4,WEEKDAY(C8,2)),4*(SUMPRODUCT(WEEKNUM(+C7:C8),{-1;1})-1))

    or if Start and End could be in the same week
    C13
    =IFERROR(SUM(MIN(4,6-WEEKDAY(C7,2)),MIN(4,WEEKDAY(C8,2)),4*1/(1/(SUMPRODUCT(WEEKNUM(+C7:C8),{-1;1}))-1)),MIN(4,NETWORKDAYS(C7,C8)))

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Calculate netdays based on hours per week

    Does the following in C13 help, and then copied to C29...etc

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The idea is to identify the minimum of 4 and the working days in the first week, and the same for the last week (Using the WEEKDAY() function).
    Then subtract the total of the working days in the first and last week from the working days in the whole month - this will always be a multiple of 5, and divide this by 5 and multipy by 4.
    Last edited by Richard Buttrey; 09-01-2019 at 12:09 PM.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    09-01-2019
    Location
    Belgium
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Calculate netdays based on hours per week

    Hey Bo_Ry & Richard Buttrey, thank you guys very much for the fast reply, mucho appreciation from me!
    I will check it out, testing now
    Last edited by Smythikal; 09-01-2019 at 12:49 PM.

  5. #5
    Registered User
    Join Date
    09-01-2019
    Location
    Belgium
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Calculate netdays based on hours per week

    I have tested both formula's and it's working great for these examples. Except if I want to change the start-/enddate (like a date in middle of month) and the number of workdays.

    The following fields can have different input: Max hours per week, Max days per week, max hours per day, price per hour, startdate and enddate.
    Max days can be between 1 and 5 days, the price and hours per day can be different and the startdate/enddate can also be just a date in the middle of the month.
    I am looking for a formula that can handle these different inputs and can calculate it based on the inputs, without me looking at a calendar

    example.jpg
    Attached Files Attached Files

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Calculate netdays based on hours per week

    How about
    C13
    =SUM(MIN(C40,7-WEEKDAY(C43)),MIN(C40,WEEKDAY(C44)-1),C40*(WEEKNUM(C44)-WEEKNUM(C43)-1))

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Calculate netdays based on hours per week

    Does

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    work for you?

  8. #8
    Registered User
    Join Date
    09-01-2019
    Location
    Belgium
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Calculate netdays based on hours per week

    Hi guys, sorry for my late reply, was a busy day.

    I have tried both of them and the formula from Bo_Ry is getting close. It only works with dates of the same year. For example if I use as startdate 05-05-2019 and enddate 10-16-2020, the formula will not work. I have tried to add multiple functions to add up the workdays of the other year, but it's getting messy.

    The formula with roundup function from Richard Buttrey doesn't work, most of the times I am always 1 day short.
    Attached Images Attached Images
    Attached Files Attached Files

  9. #9
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Calculate netdays based on hours per week

    Please try at C13
    =SUM(MIN(C4,7-WEEKDAY(C7)),MIN(C4,WEEKDAY(C8)-1),C4*(C8-WEEKDAY(C8)-C7+WEEKDAY(C7)-7)/7)

  10. #10
    Registered User
    Join Date
    09-01-2019
    Location
    Belgium
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Calculate netdays based on hours per week

    Many thanks Richard and Bo_Ry for your help, the last formula from Bo_Ry works like a charm

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to calculate hours, week by week...
    By AlbanoExcel in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-19-2014, 06:10 PM
  2. [SOLVED] Formula to Calculate Normal Hours, Time & 1/2 & Double Time from Daily Hours per week
    By KazzICC in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-17-2014, 01:51 AM
  3. Replies: 1
    Last Post: 01-02-2014, 01:18 PM
  4. [SOLVED] 40 Hours per week / how to calculate overtime hours
    By hudsonic72 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-07-2013, 02:33 AM
  5. Formula to Calculate Hours over Week Range
    By ssteines in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-20-2010, 10:41 AM
  6. Replies: 22
    Last Post: 11-29-2007, 05:03 AM
  7. Calculate Hours and overtime by week
    By gregt812 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-23-2005, 03:10 PM
  8. [SOLVED] How do I calculate the week day hours between 2 days
    By Mickey in forum Excel General
    Replies: 1
    Last Post: 10-05-2005, 08:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1