+ Reply to Thread
Results 1 to 4 of 4

Count if between 2 times

  1. #1
    Registered User
    Join Date
    02-18-2010
    Location
    Telford, england
    MS-Off Ver
    Excel 2007
    Posts
    13

    Count if between 2 times

    I have a function which seems to work counting discharges between 23:00 and 06:00.

    If i modify it to look at discharges between 06:00 and 12:00 it gives a false answer.

    Using And instead of OR fixes it, but i don't know enough about excel to understand why this works.

    I need to repeat the exercise for discharges between 12:00 to 16:00 and 16:00 to 23:00.

    I have attached an example of the data.

    Mike
    Attached Files Attached Files

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Count if between 2 times

    The difference is because of the 'roll over'

    with your first instance you can use "OR" because it is either after 23:00 (nothing will exceed 24:00) or before 06:00 (nothing can preceed 00:00) but with all of

    the other time periods there are times before and after what you are looking, so you need to use AND to bracket it.

    eg1: 7 is between 6 AND 6
    eg2: is before before 6 or after 23

    think of it as numbers, not times..

    you also might want to look to use >= to include times that are exactly on your paramater.

    hope this helps.
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Registered User
    Join Date
    02-18-2010
    Location
    Telford, england
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Count if between 2 times

    Logical thankyou,

    How do i mark this as solved?

  4. #4
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Count if between 2 times

    at the top of the thread there is an option for thread tools, in there, there should be an option for mark thread as solved, this post may have exceeded the time for you to mark yourself, if so you can post a link to this thread here:

    http://www.excelforum.com/the-water-...rk-solved.html

+ 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