+ Reply to Thread
Results 1 to 9 of 9

How do I count the number of occurrences for a time range using CountIF?

  1. #1
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    How do I count the number of occurrences for a time range using CountIF?

    I am trying to write a formula but with no success yet. I have a range of time data that I want to write a COUNTIF formula for which will give me the number of times a time range was under 07:00 (H:mm). I wrote the following below but no success. Any help please?

    COUNTIF('ED Data'!AI2:AI7, " < =" 'ED Data'!AK2) where ED Data is where the range is in another worksheet. I for some reason could not enter the criteria of 07:00 thus I defined the cell AK2 as being 07:30 (H:mm).

    Thanks in advance
    Last edited by KatMat232; 07-07-2017 at 04:25 PM.

  2. #2
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: How do I count the number of occurrences for a time range using CountIF?

    Please any help?

  3. #3
    Forum Contributor
    Join Date
    07-13-2015
    Location
    Quebec, Canada
    MS-Off Ver
    2013
    Posts
    232

    Re: How do I count the number of occurrences for a time range using CountIF?

    Hi,

    Might be better to post a workbook, but anyway:

    Please Login or Register  to view this content.
    Where AK2 contains 7:00 (why 7:30?)

  4. #4
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: How do I count the number of occurrences for a time range using CountIF?

    Quote Originally Posted by Jdevil View Post
    Hi,

    Might be better to post a workbook, but anyway:

    Please Login or Register  to view this content.
    Where AK2 contains 7:00 (why 7:30?)
    7:30 was a typo. I just edited it. I will try your formula and let you know. THank you

  5. #5
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: How do I count the number of occurrences for a time range using CountIF?

    You can remove the need for your extra cell using this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  6. #6
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: How do I count the number of occurrences for a time range using CountIF?

    Quote Originally Posted by Jdevil View Post
    Hi,

    Might be better to post a workbook, but anyway:

    Please Login or Register  to view this content.
    Where AK2 contains 7:00 (why 7:30?)
    Thanks JDevil - it works!! Curious though instead of having the AK2 as a place order for the 7:00, is there a way I can introduce the 7:00 time into the formula?

  7. #7
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: How do I count the number of occurrences for a time range using CountIF?

    Quote Originally Posted by Aardigspook View Post
    You can remove the need for your extra cell using this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Thank you Aardig - just saw your post as I replied and it works also. THank you both.

    One more question, can this type of formula be inserted into a Pivot Table via a Calculated Field? I have tried this originally and nothing worked which is why I went the manual route.

  8. #8
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: How do I count the number of occurrences for a time range using CountIF?

    I'm not good with pivot tables, but from what I can see, it's difficult to do a CountIf directly. What you could do is put another column next to your times with an IF check in it, something like IF(AI2<=TIME(7,0,0),1,0). Then pivot that and sum the If column. I'm not sure if that makes sense , so attached is a file which hopefully shows what I mean.
    Attached Files Attached Files
    Last edited by Aardigspook; 07-07-2017 at 05:55 PM.

  9. #9
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: How do I count the number of occurrences for a time range using CountIF?

    Quote Originally Posted by Aardigspook View Post
    I'm not good with pivot tables, but from what I can see, it's difficult to do a CountIf directly. What you could do is put another column next to your times with an IF check in it, something like IF(AI2<=TIME(7,0,0),1,0). Then pivot that and sum the If column. I'm not sure if that makes sense , so attached is a file which hopefully shows what I mean.
    Okay. Will try. Thank you.

    Btw if anybody has any other suggestions, please share. Thanks one and all

+ 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. Count occurrences of value in a date range I can specify easily each time
    By mikalaka in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 07-14-2014, 07:14 PM
  2. How to track number of occurrences during a particular time range
    By 4mantras in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-15-2014, 01:55 PM
  3. [SOLVED] Use Countif and ?? to count occurrences of text string in a column
    By CWatsonJr in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-23-2014, 03:08 PM
  4. Replies: 0
    Last Post: 07-28-2013, 10:24 AM
  5. Replies: 7
    Last Post: 09-19-2012, 12:25 AM
  6. Formula to Count the Number of Occurrences of a Text String in a Range
    By poug1903 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-10-2011, 06:49 AM
  7. Replies: 1
    Last Post: 09-18-2009, 04:15 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