+ Reply to Thread
Results 1 to 19 of 19

counting times

  1. #1
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    counting times

    Guys just a quick one,
    in cell F5 I would like to know how to count the times between 13:00 am and 14:00 so if theres 3 times it will show a 3 i havnt got a clue what formula to use thanks anybody who can help
    Attached Files Attached Files
    Last edited by dodger999; 08-26-2009 at 07:39 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: counting times

    Based purely on your sample file, one method might be:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: counting times

    Thanks for the quick reply but being the novice i am im a bit lost even though it does work i dont understand it sorry

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: counting times

    It counts the number of entries in B where the HOUR of said entry equates to the requisite value be it 11, 12 etc...

    The requisite hour (11, 12, 13 etc...) is determined by taking 10 and adding to that the number of columns in the specified range... in the first column that increment will be 1 (one column in range $D5:D5) therefore hour 11, when the formula is copied to E5 the increment will become 2 given there are two columns present in the range $D5:E5 and therefore making hour = 12 ... and so on and so forth.

    For more info. on SUMPRODUCT and coercion (--) refer to the link in my signature.

  5. #5
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: counting times

    Many thanks for the explanation

  6. #6
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: counting times

    Sorry 1 other problem thats just hit me is i should have put in AM times i:e cells should read 00:01 after midnight so 13:55 should really be 01:55 how do i get around this problem sorry to be a pain

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

    Re: counting times

    It shouldn't matter. eg. HOUR(1:00 PM) will be 13 and HOUR(1:00 AM) will be 1. Is it not working for you?
    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

  8. #8
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: counting times

    It is working in + mode and i do understand more of what you explained but i need to go into AM now as you can see from my amended sheet im lost again
    Attached Files Attached Files

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: counting times

    Based on your revised setup such that first calculation (D5) is for 11:00 PM then:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: counting times

    Ok i had the same result without using mod i am using a larger database than shown so when i extend b5:b11 to B5:B30 say I get 23 as the result it seems now to be counting the blank cells this is head banging im so sorry
    Attached Files Attached Files

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: counting times

    Yes, that's because HOUR(blank) = 0 ... so based on the latest version:

    Please Login or Register  to view this content.
    It might be easier to use a Pivot Table ...

  12. #12
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: counting times

    Thanks for your time it worked very well on the small sheet but when copied to my larger sheet nothing so i think i should give up just cant see whats wrong anywhere

  13. #13
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: counting times

    This is last hope here is my dummy sheet in full just to show if anything is wrong
    Attached Files Attached Files

  14. #14
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: counting times

    The values in J are not numbers per se - they are numbers stored as text.

    Based on the latest file:

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: counting times

    All works apart from 12:00 (Q80) this is so strange any ideas? this is the sheet im using it worked on the dummy sheet because it was text but i need formulas in them as you can see from this sheet
    Attached Files Attached Files
    Last edited by dodger999; 08-27-2009 at 04:01 PM.

  16. #16
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: counting times

    The issue is that the values that appear to be blank (eg J93 etc) do in fact contain the value 0 it's just that your display options are set that zero does not display.

    Based then on the fact that valid results are Text (ie the zeroes imply not time) and again based purely on the last file:

    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: counting times

    i suppose the only other way is to do a countif formula for the 12:00 cell but that would mean 59 formulas

  18. #18
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: counting times

    I confess I no longer have any idea what the issue is ... the last formula will, based on your file, generate numbers as requested.

  19. #19
    Registered User
    Join Date
    02-10-2007
    Posts
    97

    Re: counting times

    You cracked it cant believe it thanks a million for you patience it was the text i needed i didnt even no it exsisted i will put solved on thanks again

+ 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