+ Reply to Thread
Results 1 to 8 of 8

Need a Formula to help count up the number of hits between 2 times.

  1. #1
    Registered User
    Join Date
    11-02-2011
    Location
    Monterey, Ca
    MS-Off Ver
    MS Excel 2007
    Posts
    10

    Need a Formula to help count up the number of hits between 2 times.

    Hi There,
    So I'm trying to total up the total number of hits between 2 times (the times I'm using are relative to the start time for the project but are in HH:MM:SS).

    Eg. I need to find how many records are between 14:00:00 and 14:00:10 from a list of 300 times.

    I'd rather not have to manually enter the times but reference the cell that the two outer limit times are in.

    Hopefully this makes some sort of sense!

    Thanks for your help!

    Aaron
    Last edited by Fishkeeper101; 11-06-2011 at 06:55 PM.

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,255

    Re: Need a Formula to help count up the number of hits between 2 times.

    Welcome to the forum.

    Suppose the following:
    • A2:A300 contains the list of times
    • D2 contains the start time
    • E2 contains the end time

    Then this formula will count the number of times between the two times (inclusive):
    Please Login or Register  to view this content.
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Registered User
    Join Date
    11-02-2011
    Location
    Monterey, Ca
    MS-Off Ver
    MS Excel 2007
    Posts
    10

    Re: Need a Formula to help count up the number of hits between 2 times.

    Hi Colin,
    Thanks so much for the response. So I tried plugging that in and it didn't error out on me, but it doesn't seem to be counting the actual values. Some of them are really high (5 or 7 in times that shouldn't have anything, times that should have 1 or two don't have any)... Is this an error on my part?

    Thanks again for the quick response!

    Aaron

    PS... =COUNTIFS($A$2:$A$371,">="&G2,$A$2:$A$371,"<="&G3) is the formula I'm using to adjust for my data

  4. #4
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,255

    Re: Need a Formula to help count up the number of hits between 2 times.

    Hi Aaron,

    There's probably an issue with your data; perhaps the times are stored as text or perhaps there are dates (not shown due to formatting) within the cells. If you attach an example workbook we should be able to get to the bottom of it quite quickly?

  5. #5
    Registered User
    Join Date
    11-02-2011
    Location
    Monterey, Ca
    MS-Off Ver
    MS Excel 2007
    Posts
    10

    Re: Need a Formula to help count up the number of hits between 2 times.

    Awesome! attached is the worksheet. A is the actual data and I'm trying to get counts in H. The time bracket is just every 5 s for the entirety of the data.
    Attached Files Attached Files

  6. #6
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,255

    Re: Need a Formula to help count up the number of hits between 2 times.

    Hi,

    I spotted a couple of things.


    Firstly, most of your times in column A are stored as text.

    The ones that look like normal times can be converted to numbers quite easily. You can use Text to Columns or a manual method would be:
    • Type 1 into an empty cell.
    • Copy that cell
    • Select A2:A301
    • Right click > paste special
    • In the Paste section choose "Values" and in the Operation section choose Multiply
    • Click OK
    • Then format the cells as hh:mm:ss



    There are a couple of cells which cannot be changed this way because of the data they contain: (see the data in cells A366:A369)
    14:48:0 approx
    15:06:02 (rov
    17:45:17 (from ROV clock)
    17:45:17 (from ROV clock)
    I realise that these ones are outside of the range referenced by your formula but thought I should mention them.


    Secondly, in your times in column G, you have some irregularities in the time pattern. For example, cell G310 contains the value 19:12:00 when it should be 14:55:40

  7. #7
    Registered User
    Join Date
    11-02-2011
    Location
    Monterey, Ca
    MS-Off Ver
    MS Excel 2007
    Posts
    10

    Re: Need a Formula to help count up the number of hits between 2 times.

    Oh my God. You are my hero. Haha. Thanks so much. I'll switch this guy over to solved.

    --Aaron

  8. #8
    Registered User
    Join Date
    11-02-2011
    Location
    Monterey, Ca
    MS-Off Ver
    MS Excel 2007
    Posts
    10

    Re: Need a Formula to help count up the number of hits between 2 times.

    Ok, one more quick question. I did everything you said and it's calculating now, but it now seems to be over counting some and missing others... Any ideas?

+ 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