+ Reply to Thread
Results 1 to 5 of 5

Listing event start and end times from time series

  1. #1
    Registered User
    Join Date
    01-10-2024
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2021
    Posts
    2

    Listing event start and end times from time series

    Hi,
    I'm new to this group, and fairly new to Excel, so I'm hoping someone can help me with this.
    I have no experience with Visual Basic, so I'm also hoping there may be a solution using Excel formulas.

    I have a long time series that logs the presence of events. I'm hoping to get the start time for each event and the end time of each event.
    The data is organized with one column of consecutive times (in 0.5 second increments, >10,000 rows) and the adjacent column is whether an event was present at that time.
    If the event was present, there is a "1" for that time. If the event was not present, there is a "0" for that time.
    The events last for several seconds (i.e. several rows of 1's).
    So, the output that I hope to get is the start time and the end time of each event (the first "1" and the last "1" of each event).
    I've attached a file with sample data and manually calculated results.

    I'm using Excel 2021 on a PC.
    I really appreciate any help!
    Thanks!
    -jeremy
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Listing event start and end times from time series

    I'm using Excel 2021 on a PC.
    Your forum profile says 365 - please update your profile with the version you are using. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    01-10-2024
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2021
    Posts
    2

    Re: Listing event start and end times from time series

    Thanks! I’ve now corrected it to Excel 2021.

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Listing event start and end times from time series

    Put this formula in C2:

    =IF(B2<>1,"",IF(OR(B1=0,B3=0),MAX(C$1:C1)+1,""))

    then copy it down to the bottom of your data. Then you can use this formula in cell G2:

    =IF(ROWS($1:1)*2>MAX($C:$C),"",INDEX($A:$A,MATCH(ROWS($1:1)*2-1,$C:$C,0)))

    Copy it into H2, and edit the formula to remove the -1 (shown in red above), then copy both formulae down as far as you think you need them.

    Hope this helps.

    Pete

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Listing event start and end times from time series

    With Excel 2021, try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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] Listing only the first time event from a series of time events
    By CSASCott in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 12-14-2022, 02:42 PM
  2. Replies: 2
    Last Post: 11-05-2020, 04:12 AM
  3. [SOLVED] Creating a graph with start times and end times vs time
    By khoadphamm in forum Excel General
    Replies: 14
    Last Post: 12-31-2019, 02:57 PM
  4. [SOLVED] Weighted Average of Sequential Time Based Data Series Using Start/End Time Input
    By marcoyul in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-16-2017, 12:10 PM
  5. Listing a series of times in time order
    By Theale in forum Excel General
    Replies: 16
    Last Post: 01-25-2017, 01:50 PM
  6. Event Start time difference 10 mints in a particular day it take 1 count
    By kuldeepchoudhary in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-18-2016, 05:59 AM
  7. Replies: 4
    Last Post: 03-02-2016, 02:46 AM

Tags for this Thread

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