+ Reply to Thread
Results 1 to 5 of 5

Count occurrences and sum values with times spanning over midnight.

  1. #1
    Registered User
    Join Date
    01-22-2011
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    5

    Count occurrences and sum values with times spanning over midnight.

    I am trying to count Count occurrences between two times spanning over midnight. It all works as long as the time not goes over 00:00. This is what I have

    A=date and values in 2012-01-02 00:30:00 format
    B=Value in 10/20/30 This is some thing I will deal with after i have figured out my occurrences problem

    This is what I have come up with =PRODUKTSUMMA(--(TIMME(A2:A50)>=7);(--(TIMME(A2:A50)<=23)))
    But this only works when not the time is between say start time:23:23 too 05:45 and it can not specify down two minutes criteria. Any help would be greatly appreciated
    Attached Files Attached Files
    Last edited by SorZer; 12-11-2012 at 07:13 AM.

  2. #2
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Count occurrences and sum values with times spanning over midnight.

    Hi SorZer

    Try in:
    H3: =SUMPRODUCT(--(A2:A50-INT(A2:A50)>F3),--(A2:A50-INT(A2:A50)<G3))
    H4: =SUMPRODUCT(--((A2:A50-INT(A2:A50)>=F4)+(A2:A50-INT(A2:A50)<=G4)))

    See your file attached.

    Kevin
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    01-22-2011
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Count occurrences and sum values with times spanning over midnight.

    It almost works .. :-) it keeps on counting blanks as occurrences. And how can i get it to count values at each occurrence.
    =PRODUKTSUMMA(--((A2:A1000-HELTAL(A2:A1000)>=F4)+(A2:A1000-HELTAL(A2:A1000)<=G4)))

    Becomes 968 occurrences?!?!?

    Se new example
    Attached Files Attached Files

  4. #4
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Count occurrences and sum values with times spanning over midnight.

    Hi

    Well in your original post, the range you were looking in was A3:A50, so that was the same range I used. You changed the range to A2:A1000, where there were 950 blanks, "0". In other words, they were all less then 07:00!

    Now in Cell H4 replace the formula with:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    See the attached.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-22-2011
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Count occurrences and sum values with times spanning over midnight.

    Thank you so much!!!! it all works well.

+ 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