+ Reply to Thread
Results 1 to 11 of 11

Classifying time-stamped events into time intervals

  1. #1
    Registered User
    Join Date
    12-06-2018
    Location
    Norway
    MS-Off Ver
    1811
    Posts
    31

    Classifying time-stamped events into time intervals

    Hello,

    I have a list of events which have been time-stamped. Now I need to classify these events into time intervals of 80 seconds. I've uploaded a sample of my data.

    Taking cell C2 as an example, the event "Head-up" lasts from 10:38:00 to 10:38:51. Then, the next event "Grooming" (cell C3) starts at 10:38:52 and lasts until 10:38:56. The next Event "Unknown" (cell C4) starts at 10:38:57 and lasts until 10:38:59 and so on..

    Columns E to M represent the duration of each event within the time interval on column D.

    The event "End" marks the end of an observation and doesn't need to be included in the interval classification. As an example, the event "Unknown" (cell C14) lasts from 10:49:34 until 10:50:20, which time-stamps with cell C15 "End". The next event to be included in a 80 second interval should be "Grazing" (cell C16) starting at 10:51:00.

    Is there a way to automat such process in Excel (maybe with FREQUENCY function)? If not, could somebody give me a solution to keep on going? The list of time-stamped events is massive so this cannot be done by hand. I need to classify events for all 80 second time-intervals starting 6/19/2018 at 10:37:20 to 6/24/2018 at 20:00:00.

    Thanks in advance for your help, any input is appreciated!

    Very best
    Juan
    Attached Files Attached Files
    Last edited by juansalix; 01-16-2019 at 10:51 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Classifying time-stamped events into time intervals

    How did you arrive at the values in col D?

    What does the 40 in F2 mean?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Classifying time-stamped events into time intervals

    Formula C2 =B2

    Formula C3 =IF(B3>C2+80/24/60/60,B3,C2+80/24/60/60) then fill down.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Classifying time-stamped events into time intervals

    I added columns D through H:
    Attached Files Attached Files
    Bernie Deitrick
    Excel MVP 2000-2010

  5. #5
    Registered User
    Join Date
    12-06-2018
    Location
    Norway
    MS-Off Ver
    1811
    Posts
    31

    Re: Classifying time-stamped events into time intervals

    Thank you for your input. This very well classifies to which interval each event belongs to. However, what I need is to count how many seconds of that event happen within that given interval. I've replied under for more details

  6. #6
    Registered User
    Join Date
    12-06-2018
    Location
    Norway
    MS-Off Ver
    1811
    Posts
    31

    Re: Classifying time-stamped events into time intervals

    Thank you very much for your input. I've been now working into this and have come around a better way of presenting my data.

    To go straight to the point, you can see the list of time-stamped events on the "data" attached file (columns A to C)

    The set of 80 second time intervals (columns D and E, F is just a descriptive column) are also there.

    What I need to do is to create a table sumarizing the duration (in seconds) of all the existing events during each time interval in columns D and E.

    Ideally, I'd like my output to look like the "output" attached file. In the empty cells should be the duration of each event during the indicated time interval, the total duration in seconds of all events should therefore be 80 as this is an 80 second interval.

    My question is wether this can be done in Excel or I need a different software. Maybe R?

    Hope I can get some more advice!
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Classifying time-stamped events into time intervals

    When you assign a time to an event, is that the start of the event or the end of the event? Has the data set changed? The file Data.xlsx is in a different layout that the original one that you posted and that I used to create formulas with....

  8. #8
    Registered User
    Join Date
    12-06-2018
    Location
    Norway
    MS-Off Ver
    1811
    Posts
    31

    Re: Classifying time-stamped events into time intervals

    Thanks for your reply. In the original post "sample".xlsx the time assigned to each event is the start of the event.


    Yes, in the file data.xlsx I've changed the layout since I though that would make it more clear.


    Anyways, I've also been doing some work on the file you uploaded and have added a column with the end of each event (column C). Hope this helps.


    As you can see I've been able to create a column counting the seconds of each event in the given interval (column I), although when there's a time mismatch between the interval in which the event happened and the set 80 second interval, I'm left with a surplus (column J), that I'm not able to match with the given interval.


    Maybe you know how to do this? As an example cell J2 has 11 seconds of surplus. Ideally, there should be a new 3rd row with "Head up" as an Event (A3), interval 2 in cell E3 (because the interval 1 has already been "saturated"), and Event duration in interval I3 should be 11 seconds (the 11 seconds of surplus), and so on.


    This needs to be done everytime the surplus value is not 0. For big surplus values (ex. J5), several rows should be created "filling" the 80 second time intervals.


    Anyways, any input is appreciated as always! Thanks in advance for your time.
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Classifying time-stamped events into time intervals

    There is an issue with your time stamps that we need to address before proceeding. For example:

    Event 6/19/2018 10:37:20 Event Finish
    Head-up 6/19/2018 10:38:00 19/6/2018 10:38:51
    Grooming 6/19/2018 10:38:52 19/6/2018 10:38:56

    There is one second per transition that is not accounted for, given simple subtractions. So, either

    1) the event finish times need to be the same as the next event's start time
    or
    2) we need to add 1 second to each event.

    It really shouldn't matter except for at boundary events...

    How do you want to proceed?

  10. #10
    Registered User
    Join Date
    12-06-2018
    Location
    Norway
    MS-Off Ver
    1811
    Posts
    31

    Re: Classifying time-stamped events into time intervals

    Hello! Don't know if my previous message was posted but yes, number 1) option seems perfectly fine to me.

    Please let me know if you need any additional information. Thanks again for your interest.

  11. #11
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Classifying time-stamped events into time intervals

    OK - try this macro on your data sheet. I had to clean up a lot of your data since the times were not exact seconds. It may take a while to run,

    Please Login or Register  to view this content.

+ 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. Help with classifying events using time stamps
    By LovelyHead in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-31-2017, 01:51 PM
  2. [SOLVED] VBA strange behavior On time events firing at unexpected time intervals.
    By Kramxel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2014, 05:58 AM
  3. [SOLVED] Grouping events based on Time Intervals in Pivots
    By hutch2hutch in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 06-13-2013, 05:10 AM
  4. [SOLVED] Binning Time Stamped Data into Intervals
    By pickslides in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-29-2012, 05:48 PM
  5. Converting Data in Irregular Time Intervals into Regular Time Intervals
    By AlexJT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-25-2011, 02:42 AM
  6. Need to Transpose Irregular Time Intervals into Regular Time Intervals
    By AlexJT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2011, 08:30 PM
  7. averaging time stamped data chuncks at regular row intervals
    By edwardsn2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-05-2007, 01:29 AM

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