+ Reply to Thread
Results 1 to 4 of 4

COUNTIF statement to count between two times spanning overnight

  1. #1
    Forum Contributor
    Join Date
    08-20-2009
    Location
    Plymouth, England
    MS-Off Ver
    Excel 2013
    Posts
    149

    COUNTIF statement to count between two times spanning overnight

    Hi all,

    I have this COUNTIF statement which counts how many times fall between 9am and 9pm, which works fine:

    =COUNTIFS(F4:F34,">9:00",F4:F34,"<21:00")

    I would also like to count how many times fall between 9pm and 9am, however the same COUNTIF statement doesn't work (switching 9:00 for 21:00 and 21:00 for 9:00).

    Can anyone help?

    Thanks,

    Luke
    Last edited by lukela85; 02-04-2017 at 02:54 PM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: COUNTIF statement to count between two times spanning overnight

    Do you have a date column that you can also refer to?

    If not, you can use two COUNTIF terms - one looking for < 9:00 and the other looking for > 21:00 and add them together.

    Hope this helps.

    Pete

  3. #3
    Forum Contributor
    Join Date
    08-20-2009
    Location
    Plymouth, England
    MS-Off Ver
    Excel 2013
    Posts
    149

    Re: COUNTIF statement to count between two times spanning overnight

    Thanks for your nudge in the right direction Pete!

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: COUNTIF statement to count between two times spanning overnight

    You're welcome.

    Pete

+ 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. Replies: 3
    Last Post: 08-17-2022, 11:21 AM
  2. Average of Times Spanning Midnight
    By LJenny in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 11-24-2015, 10:44 AM
  3. [SOLVED] Long Countif statement Not to Count Blank Cells
    By Jiptastic in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-30-2013, 01:44 PM
  4. [SOLVED] Count occurrences and sum values with times spanning over midnight.
    By SorZer in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-14-2012, 04:12 AM
  5. [SOLVED] Using SUMPRODUCT or COUNTIF to count number of times a value occurs
    By Moco123 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-04-2012, 09:50 AM
  6. If statement spanning range of cells
    By Snouty in forum Excel General
    Replies: 7
    Last Post: 04-07-2010, 03:46 PM
  7. [SOLVED] COUNTIF:count the number of times
    By swarfmaker in forum Excel General
    Replies: 6
    Last Post: 10-02-2005, 07: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