+ Reply to Thread
Results 1 to 3 of 3

Calculate sum of rows until values changes

  1. #1
    Registered User
    Join Date
    02-07-2011
    Location
    Raleigh, USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Exclamation Calculate sum of rows until values changes

    Hi,
    I'm having a hard time trying to calculate the time duration of an alarm event. When an alarm is activated the cell will have a value of 1. The time collection of events is every minute (under the Time Stamp column) so if the alarm lasts for 5 minutes then there will be 5 rows with a value of “1” under the Alarm column (see attachment). So my dilemma is trying to calculate the sum of the time the value of the rows is ="1". I want to have a formula or vb code that will give me the time duration of an alarm (from the moment it activated (=”1”) until it de-activated (=”0”). Notice there are several occasions this happens. I am not looking for the total of ALL alarms, just from where it activated until it de-activated.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    01-24-2011
    Location
    Sheppey
    MS-Off Ver
    Excel 2010
    Posts
    239

    Cool Re: Calculate sum of rows until values changes

    In the first cell next to the "Alarm" put in the formula = IF ( E6 = 1 , 1 , 0 )
    in the cell below this put in = IF ( E7 = 0 , 0 , IF ( AND ( E7 = 1 , F6 <> 0 ) , E7 + F6 , 1 ) )
    And then drag the formula down to the end of the list.
    This simple adds up the "1,s" until the next "0".
    If you only want to see the final count then use conditional formating, use the formula option with if the cell equals "0" or the cell above is less than the cell your in then change the font colour to white.

  3. #3
    Registered User
    Join Date
    02-07-2011
    Location
    Raleigh, USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Calculate sum of rows until values changes

    Great that worked.

    Thanks

+ 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