+ Reply to Thread
Results 1 to 9 of 9

Counting the number of times in a column certain date & time conditions are met

  1. #1
    Registered User
    Join Date
    11-21-2013
    Location
    leicester
    MS-Off Ver
    Excel 2007
    Posts
    3

    Smile Counting the number of times in a column certain date & time conditions are met

    I have a spread sheet that contains dates in column A and times in column B and I wish to automatically count the number of times against each date that the time falls between two parameters. below is an example of the data.;
    DATE TIME
    29/06/2013 15:44
    30/06/2013 15:20
    30/06/2013 09:25
    29/06/2013 13:45
    28/06/2013 12:45
    27/06/2013 07:50
    29/06/2013 17:15
    28/06/2013 11:20
    30/06/2013 09:44
    30/06/2013 10:50
    30/06/2013 17:10
    29/06/2013 11:50
    29/06/2013 13:05
    30/06/2013 10:35
    30/06/2013 11:02
    28/06/2013 11:40
    29/06/2013 14:25
    30/06/2013 11:40
    30/06/2013 12:05
    29/06/2013 13:47
    30/06/2013 11:10
    29/06/2013 17:20
    29/06/2013 14:20
    29/06/2013 19:05
    30/06/2013 07:45
    30/06/2013 10:04
    30/06/2013 10:17
    30/06/2013 14:02
    30/06/2013 15:14

    I need to count for each date the number of occurences that fall between the following time intervals

    00:01-03:00 03:01-06:00 06:01-09:00 09:01-12:00 12:01-15:00 15:01-18:00 18:01-21:00 21:01-24:00

    What would be the best formula to use. I have been trying " Countif" but cant get the syntax right.
    Any help

    Cheers
    Last edited by Pebbles33; 11-25-2013 at 09:34 AM.

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Counting the number of times in a column certain date & time conditions are met

    Assuming you have Date in Col. A from A2:A30 and Time in Col. B from B2:B30 then set the upper time intervals in Col. C from C2:C9 as 03:00,06:00,09:00........00:00 from C2:C9. Then select D2:D9 and in the active cell (D2) type the below formula and confirm it with Ctrl+Shift+Enter

    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Registered User
    Join Date
    11-21-2013
    Location
    leicester
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Counting the number of times in a column certain date & time conditions are met

    Thanks but how does that give me a count against each date seperately.

    cheers

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Counting the number of times in a column certain date & time conditions are met

    The FREQUENCY function returns a frequency distribution as a vertical array. For a given set of values and a given set of bins (or intervals), a frequency distribution counts the number of values that occur in each interval.

    The FREQUENCY function syntax is as follows:

    FREQUENCY(data_array, bins_array)

    The function returns the number of elements you specify in the data_array argument that fall within the intervals you specify in the bins_array argument.

    For more information go through the following links...

    http://support.microsoft.com/kb/100122

    http://office.microsoft.com/en-in/ex...010342543.aspx

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Counting the number of times in a column certain date & time conditions are met

    Here's a solution that takes date and time into account, building on sktneer's original suggestion.
    With the dates in E1:N1 and times in D2:D10 (including a time of 0)

    Select E2:E10 and enter in this array function
    =IF($D2:$D10=0,"",FREQUENCY($B$2:$B$30+$A$2:$A$30,E$1+$D$2:$D$10))
    Use CNTRL SHFT ENTER instead of ENTER and that formula E2:E10 with {} around them.
    Then drag formula to the right. See attachment
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  6. #6
    Forum Contributor
    Join Date
    12-02-2004
    Location
    London
    Posts
    255

    Re: Counting the number of times in a column certain date & time conditions are met

    I would either use a pivot table or use sumproduct. The attachment has you sample data grouped by both methods
    Attached Files Attached Files

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Counting the number of times in a column certain date & time conditions are met

    Another way to achieve this using simple COUNTIF function. Try this.......

    Please Login or Register  to view this content.
    Please see the attached sheet.
    Attached Files Attached Files

  8. #8
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Counting the number of times in a column certain date & time conditions are met

    Thanks ChemistB ! That means a lot to me because I got attention from a Forum Guru. Thank you so much for the appreciation. You simply made my day.

  9. #9
    Registered User
    Join Date
    11-21-2013
    Location
    leicester
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Counting the number of times in a column certain date & time conditions are met

    Many thanks to sktneer Gary Brown and Chemistb for your replies I now understand how to achieve this and the problem is solved.
    Cheers

+ 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. [SOLVED] Counting the number of times a time appears in a range of data
    By alexw1 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-04-2013, 12:23 PM
  2. [SOLVED] Counting the number of times a date occurs in multiple start and end date ranges.
    By Grizz in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 03-05-2013, 04:41 PM
  3. Replies: 5
    Last Post: 08-06-2012, 03:47 PM
  4. Counting Number of Times Column Changes 10%
    By WangDoodle in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-02-2008, 11:23 PM
  5. Counting the number of times a certain date appers
    By ignitedaz in forum Excel General
    Replies: 1
    Last Post: 08-16-2006, 04:30 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