+ Reply to Thread
Results 1 to 4 of 4

Excel 2010 - Business Hrs excluding holiday and weekend - results in negative error

  1. #1
    Registered User
    Join Date
    07-25-2011
    Location
    Oklahoma
    MS-Off Ver
    Excel 2007
    Posts
    2

    Excel 2010 - Business Hrs excluding holiday and weekend - results in negative error

    Using the following formula, I receive a negative number error (######) when clearly the start and end dt/times are not weekend/holiday/afterhrs or out of sequence. How do I fix this formula to give 00:34 Business Hrs on the first example below instead of the error ## for the -.23?

    =IF(BN2-BE2<0, #VALUE!, (NETWORKDAYS(BE2, BN2, Holidays!$B$2:$B$34)-1)*(CH2-CG2)+IF(NETWORKDAYS(BN2, BN2, Holidays!$B$2:$B$34),MEDIAN(MOD(BN2,1), CH2, CG2), CH2)-MEDIAN(NETWORKDAYS(BE2, BE2, Holidays!$B$2:$B$34)*MOD(BE2,1), CH2, CG2))

    Start Dt/Time End Dt/Time Start Day End Day Business Hrs
    9/1/2012 10:19 9/1/2012 10:53 06:00 23:00 (0.23)
    9/1/2012 14:10 9/1/2012 14:58 06:00 23:00 (0.23)
    8/31/2012 23:55 9/4/2012 6:19 07:00 15:00 (0.40)
    8/31/2012 23:55 9/4/2012 6:20 07:00 15:00 (0.40)
    9/4/2012 16:10 9/5/2012 6:15 06:00 14:30 (0.06)
    9/4/2012 16:10 9/5/2012 6:15 06:00 14:30 (0.06)
    9/4/2012 16:09 9/5/2012 6:15 06:00 14:30 (0.06)
    Attached Files Attached Files
    Last edited by jlgenzler; 11-15-2012 at 07:27 PM. Reason: remove transactions starting/ending on Sat/Sun and submit attachment

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Excel 2010 - Business Hrs excluding holiday and weekend - results in negative error

    Your formula works for me - 1st September 2012 was a Saturday so result for first row of your examples should be zero.....that's what I get.

    For 3rd example [8/31/2012 23:55 to 9/4/2012 6:19] I format result cell as [h]:mm and get 17:19 - that's one full day on 3rd Sept @ 17:00 and 0:19 on 4th Sept

    Are you referencing the right cells in the formula? Can you post the worksheet or a sample?
    Audere est facere

  3. #3
    Registered User
    Join Date
    07-25-2011
    Location
    Oklahoma
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Excel 2010 - Business Hrs excluding holiday and weekend - results in negative error

    Thank you for your quick response. I have taken out those starting and ending on the weekend and uploaded the spreadsheet as requested.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Excel 2010 - Business Hrs excluding holiday and weekend - results in negative error

    It appears that the formula isn't working because the daystart and dayend columns aren't true times because they are formatted as text - I made those columns numeric by doing this:

    Select column D > Data > Text to columns > Finish

    repeat for column E

    ....now the formula works unaltered, see attached
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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