+ Reply to Thread
Results 1 to 7 of 7

CountIf NetWorkDays Formula Results

  1. #1
    Registered User
    Join Date
    02-26-2010
    Location
    St. Louis, MO
    MS-Off Ver
    Excel 2007
    Posts
    55

    CountIf NetWorkDays Formula Results

    I have a formula that calculates the amount of hhmmss between 2 date times using the networkdays function. Is there a way to use a countif formula to count the number that are:

    < 00:59:59
    > 01:00:00 and < 01:59:59
    > 02:00:00 and < 02:59:59
    > 03:00:00

    each one of the 4 lines would be a seperate formula.

    Here is what I have but it isn't working

    =COUNTIF(D:D,"< 00:59:59")

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: CountIf NetWorkDays Formula Results

    Do the cells in column D have dates and times or just times?
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,618

    Re: CountIf NetWorkDays Formula Results

    With XL2007 you can use COUNTIFS:

    =COUNTIFS($H$1:$H$20,">=1:00:00",$H$1:$H$20,"<2:00:00")

    or this in one row and pull formula down (so you don't need to change numbers manualy)

    =COUNTIFS($H$1:$H$19,">="&2.5*ROW(A1)/60,$H$1:$H$19,"<"&2.5*(ROW(A1)+1)/60)

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,724

    Re: CountIf NetWorkDays Formula Results

    You just need to remove the space:

    =COUNTIF(D:D,"<00:59:59")

    As shown above, you can include multiple criteria using COUNTIFS in 2007.

    Also, I'm not sure why you are using NETWORKDAYS if you just want the difference between two times. NETWORKDAYS returns an integer number of weekdays between two dates, not times as you are using in your comparison. To get the time between two times, just subtract.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Registered User
    Join Date
    02-26-2010
    Location
    St. Louis, MO
    MS-Off Ver
    Excel 2007
    Posts
    55

    Re: CountIf NetWorkDays Formula Results

    @NBVC

    The cells in column D have just times like this: 00:47:34

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: CountIf NetWorkDays Formula Results

    Have you tried zbor's suggestions...

    you can also use

    =COUNTIFS($H$1:$H$20,">"&Time(7,0,0),$H$1:$H$20,"<"&Time(14:00))

    to get times between 7 AM and 7 PM, for example

    You can replace the TIME() function with cell references to containing the upper and lower time limits...

  7. #7
    Registered User
    Join Date
    02-26-2010
    Location
    St. Louis, MO
    MS-Off Ver
    Excel 2007
    Posts
    55

    Re: CountIf NetWorkDays Formula Results

    Yes, I used zbor's for the ranges and 6StringJazzer was right on my formula, I had an extra space. It is working now for all 4 ranges

    Thanks to everyone

+ 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