+ Reply to Thread
Results 1 to 11 of 11

combine workday and time functions

  1. #1
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    combine workday and time functions

    I need to add a number of hours to an existing date/time (formatted with custom format to display date & time) cell. Time function does this but I need to ignore weekends (ie workday type function).
    My purpose is to check service level agreements performance

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: combine workday and time functions

    OK, we're listening. You can speed this along by presenting a complete scenario with sample data, sample results mocked up manually.

    Click GO ADVANCED and use the paperclip icon to post up your workbook.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: combine workday and time functions

    Why not just use the Workday function? (Since you mention it, I assume you have it. If not, just install the Analysis Toolpak add-in) If the day is in A1 and the time in B1, =Workday(A1,B1). It will, of course, start from midnight on the designated date, but you can adjust for that if necessary.

  4. #4
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: combine workday and time functions

    Thanks for the responses.

    The scenario is this:

    I am advised of an service incident by manual means and I need to log this with

    Date/Time. I then have, depending on the assigned priority, a variable amount of time to acknowledge the incident (see the constants tab for values) in accord with the agreed SLAs.
    taking the BreakFixRawData tab as an example...

    I enter the received date (col F), calculate a predicted/required date (col G), manually enter the actual date in Col H and do a simple comparison to see if I have met my SLA (Col I)

    The spreadsheet attached actually works for whole days and uses the workday function.

    My problem is that the values I was originally told were days wheras the contract values (thanks lawyers for your help!!!!) now talk in hours (2 hours, 4 hours, 12 hours, 20 hours, 80 hours).

    The Time function does not seem clever enough to deal with "working hours" (say 08:00 - 18:00)

    I wouldn't be surprised if my quest is in the "holy grail" category and that I will probably have to simply calculate the "predicted date/time" manually but I would prefer not to if I can avoid it

    Please feel free to ask more questions if I have not explained it sufficiently

    John
    Attached Files Attached Files

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: combine workday and time functions

    Quote Originally Posted by jmac1947
    My problem is that the values I was originally told were days wheras the contract values (thanks lawyers for your help!!!!) now talk in hours (2 hours, 4 hours, 12 hours, 20 hours, 80 hours).
    John, I'm still a little unclear but I'm guessing the above means you will be looking to adjust your "breakfixacknowledge" table such that the value are time based rather than day based, is that correct ?

    Assuming that is the case... ie that you're now looking to add hours to a start date time where hours must be working hours then I suspect you should be able to adapt something along the lines of the below:

    Please Login or Register  to view this content.
    where:

    F5 is your start datetime (presently just date)

    VLOOKUP determines Time available based on Priory (ie switching from Day integer to Time allocation - eg 30:00 rather than 3 days)

    D2 is start of working shift (08:00)

    E2 is end of working shift (18:00)
    you can modify the references as required of course...

    Of course the main point would be that your Start Date should really become a Start DateTime - and I guess we would assume the Start Time to be within the working hour boundaries (ie between 08:00 and 18:00)

    Is the above along the right lines ?

    To elaborate by means of example...

    If we assume the lookup value for severity 2 changes from 3 to say 30 hours and that the start datetime for your first incident becomes 13-Jan 09:00 (ie we add the time) ... then using the above formula the max completion datetime would become: 18-Jan 09:00
    (we would use 9 hours on the 13th, 10 hours on the 14th, 10 hours on the 15th (Fri) and then 1 hour on the Monday)

    It might be an idea to post an example which elaborates on the Hour element of your prior post - this is obviously the fundamental issue.


    Note: the above is c/o daddylonglegs our resident genius on all things date-related - if you search with him as user and WORKDAY etc as search term you will find a veritable goldmine of examples.
    Last edited by DonkeyOte; 01-20-2010 at 05:01 AM.

  6. #6
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: combine workday and time functions

    Hello again,

    Yes it is correct that the lookup values will be in hours (a simple interger number) as is now shown in the atttached workbook.

    I added into the "constants tab" a couple of named cells to hold day start and day end times. These cells are defined as "time format"

    I pasted in your formula but was not able to get the right result, nor could I actually get the same answer as your long hand example in the post. (although i agree that your example answer is correct).

    Unfortunately i am not at all sure I understand what the formula is actually trying to do despite trying to "de construct" it.

    I have attached the current version of the spreadsheet with your formula pasted into cell G5

    It is looking more like the "holy grail" I suspect
    Attached Files Attached Files

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: combine workday and time functions

    jmac1947,

    Time in XL is Decimal ie Noon = 0.5 as 6am = 0.25 and 6pm = 0.75 etc... (you can "see" this if you enter say any of 12:00, 06:00, 18:00 into a cell and format to General)

    Presently in your constants table you are, as you say, storing "hours" as Integers rather than as true Time values (decimals)
    Using your file, you presently have 4 for Priority 2 which equates to 4 days or 96 hours - hence the current result on the analysis sheet.

    To calculate correctly you therefore have 2 basic choices:

    1 - store Hour values as true Time values in the Constants table
    eg enter 4:00 into the cell rather than 4

    2 - keep hours as Integer and adjust the actual calculation to divide each VLOOKUP value by 24
    Needless to say option 1 is the one you should pursue else you're adding more & more calcs. to an already complex calculation.

    To demo. using the example in my prior post - should you change 4 to 30:00 for Priority 2 you will find the result in G5 on your data sheet matches result outlined previously - ie 18-Jan 09:00

    Note:
    assuming you do indeed revert to storing time values in the constants sheet, format the time cells as [h]:mm (the [ ] ensures cumulative hours are displayed - once beyond 24 hours)
    Last edited by DonkeyOte; 01-21-2010 at 08:47 AM. Reason: I can count, honest

  8. #8
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Thumbs up Re: combine workday and time functions

    Hi DonkeyOte,

    You are one seriously clever person... the solution you provided is working a treat and along the way I have learnt a couple of things as well.

    Many thanks for your help, it is much appreciated

    Jmac1947

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: combine workday and time functions

    I'm glad it's working for you...

    I can't take the credit I'm afraid - as mentioned earlier on in the thread the formula you're using is c/o of another member here - daddylonglegs - all credit must go to him - I for one don't know how he thinks them up !

  10. #10
    Registered User
    Join Date
    06-02-2010
    Location
    Ludgershall, England
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: combine workday and time functions

    Thank you DaddyLongLegs and DonkeyOte this has helped me so, so much!

  11. #11
    Registered User
    Join Date
    02-26-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: combine workday and time functions

    Thank you everyone. This helped me A LOT!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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