+ Reply to Thread
Results 1 to 7 of 7

Time between events

  1. #1
    Registered User
    Join Date
    10-17-2022
    Location
    Denmark
    MS-Off Ver
    365 2202
    Posts
    2

    Time between events

    Cross-posted at https://www.mrexcel.com/board/thread...vents.1220848/

    Hello
    I'm looking for a good idea as I am not sure where to start on this project.
    I have a list of events, every time an alarm is raised, and every time the state goes back to normal. Sometimes the program makes two alarm or two normal events, but I am only looking at the first alarm and the first "back to normal" each time. (marked with green just to show)
    I need to find the total time, the program has been in "alarm" and sum that up for the month (or between to dates)
    I guess I have to start by making the timestamp column (A) a time, and not just text, but what then? How do I find an Alarm and look for the next Normal upwards in the sheet? I hoped I could look for the next "New state" in column G, but those seem random.
    Thanks in advance for your input
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by 6StringJazzer; 11-01-2022 at 10:41 AM. Reason: added xpost link

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2020
    Location
    Thailand
    MS-Off Ver
    Office 2016
    Posts
    897

    Re: Time between events

    Hi there,

    I was not quite sure, but please have a look and see if the formulas in the attached work for what you need.

    I have split your 'text' date into a date and a time column.
    Then when we have an 'Alarm' we look for the next 'Normal' and take the time from that event.
    From there we work out the difference.

    If the times go from one day to the next, we will need to work on the date & time value to get the difference.

    I trust it should give you a start and some ideas.
    Attached Files Attached Files
    If your Question is answered; please mark it SOLVED. If you are happy with a member's solution, say 'Thanks' and click the 'Star' to Add Reputation.

  3. #3
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2402-17328.20068
    Posts
    1,361

    Re: Time between events

    I played with a code option although it does change the sort order of your data, also converted your range to a table. See attached.
    Attached Files Attached Files
    If things don't change they stay the same

  4. #4
    Registered User
    Join Date
    10-17-2022
    Location
    Denmark
    MS-Off Ver
    365 2202
    Posts
    2

    Re: Time between events

    ORoos for some reason, when I enable editing, all the formulas break and return #Value, maybe its a version issue? However it does bring some good ideas to the table, thank you very much!

    CheeseSandwich. An interesting solution I will definetly continue to work on!

  5. #5
    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,851

    Re: Time between events

    Administrative Note:

    Is your forum profile showing the version of Excel that you need this to work for?

    Members will tailor the solutions they offer to the version of Office (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent versions of Excel are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the release number in your profile (e.g. MS365 Version 2211). This is in the About Excel section further down the Account page.

    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.

  6. #6
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,427

    Re: Time between events

    Two other options with formulas:

    Option 1 for all Excel 365 users:

    Please try in O2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and in P2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and in Q2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Option 2 whole table incl header in 1 formula for users from Excel 365 with the newest functions available (from V2203)

    Please try in S1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    [Put the cursor in the formulabar before you paste formula option 2]
    Attached Files Attached Files
    Last edited by HansDouwe; 11-01-2022 at 10:28 AM.

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Time between events

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important: https://excelguru.ca/a-message-to-forum-cross-posters/

    I have added the link to your original post because you are a new member.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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] Categorize time ranges and calculate events within the time period
    By yklanka in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-09-2019, 10:16 AM
  2. Events in a time chart?
    By Frigide in forum Excel Charting & Pivots
    Replies: 9
    Last Post: 02-17-2019, 09:05 PM
  3. Classifying time-stamped events into time intervals
    By juansalix in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-24-2019, 04:17 PM
  4. [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
  5. Charting Events over Time
    By India0220 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-16-2012, 10:49 AM
  6. Chart two events over time
    By darbid in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 11-10-2008, 07:35 AM
  7. How add events to a sheet in run-time?
    By fredif in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-29-2005, 04:05 PM

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