+ Reply to Thread
Results 1 to 9 of 9

How to sum values/time difference as they switch between positive & negative

  1. #1
    Registered User
    Join Date
    10-11-2011
    Location
    Pittsboro, NC
    MS-Off Ver
    Excel 2013
    Posts
    11

    How to sum values/time difference as they switch between positive & negative

    I am trying to track furnace water temperatures throughout the day based on fuel supply, outside temps, heating demand, etc.. Temperatures are measured 8-10 times a day at irregular intervals and may consist of several sequences of falling or rising temps - each sequence may be a different number of values.
    See attached for example.
    Furnace Log Sample.xlsx
    I need to determine how far the temps fell or rose in each sequence and then determine the elapsed time for that sequence.
    It would be simple if each sequence had a consistent number of values but they don't.
    I was looking for a "SUM WHILE" type function (like a DO LOOP?) to reset to 0 each time temp direction changed but guess I'd need to go to VBA for that.
    Any ideas for a simple fix here?

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: How to sum values/time difference as they switch between positive & negative

    I can see your attempt in O column with vary formulas. What are your desired results in column O? Could you upload again with desired results?
    Quang PT

  3. #3
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: How to sum values/time difference as they switch between positive & negative

    See if you want this
    Attached Files Attached Files

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: How to sum values/time difference as they switch between positive & negative

    I am little confusing that is it column O expected result? It seems you have solution already.

  5. #5
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: How to sum values/time difference as they switch between positive & negative

    Quote Originally Posted by bebo021999 View Post
    I am little confusing that is it column O expected result? It seems you have solution already.
    But column O contains several different formula, my guess is that the OP is looking for a single formula to fill down.

    Something like this in O4

    =IF(SIGN(N4)<>SIGN(N5),SUM(INDEX(N:N,IFERROR(MATCH(1E+100,O$1:O3),1)+1):N4),"")

  6. #6
    Registered User
    Join Date
    10-11-2011
    Location
    Pittsboro, NC
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: How to sum values/time difference as they switch between positive & negative

    Thanks for the response. However, it's not quite what I need.
    Let me try to explain it more clearly (hopefully).
    Once the temp direction changes (up/down), I need to cumulate that up or down sequence (starting from zero) until the temp direction reverses itself and then cumulate that next sequence.
    So, a down sequence of 4 values (e.g., -4, -10, -12, -40) between 11:05 and 17:55 would drive the result of a temperature drop of -64 degrees over a 6h:50min period.
    Then we load some wood and open the dampers.
    The temp may then start going up for a sequence of perhaps 3 values (e.g., +8, +25, +30) between say 18:00 and 20:15. The cumulative temp gain is +63 degrees in a 2h:15min period.
    I need to sum the numbers between each change of direction and then reset to zero at the point it changes direction.
    Is this clearer?

  7. #7
    Registered User
    Join Date
    10-11-2011
    Location
    Pittsboro, NC
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: How to sum values/time difference as they switch between positive & negative

    Yes, Jason.b75 - perfect!
    My apologies, I hadn't read your solution before responding to the other reply.
    Now I need to figure out how it works so I can do the same with the time difference.

  8. #8
    Registered User
    Join Date
    10-11-2011
    Location
    Pittsboro, NC
    MS-Off Ver
    Excel 2013
    Posts
    11

    Thumbs up Re: How to sum values/time difference as they switch between positive & negative

    I managed to figure out enough of Jason.b75's formula to modify for calculating the elapsed time between temp direction changes.
    Once again, worked perfectly.
    Don't entirely understand how the "1E+100" works but I'll get there.
    Brilliant - thanks

  9. #9
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: How to sum values/time difference as they switch between positive & negative

    Quote Originally Posted by watkincm View Post
    Don't entirely understand how the "1E+100" works but I'll get there.
    1E+100 is a very big number (1 followed by 100 0's, i.e. 1E+3 = 1000, 1E+6 = 1000000, etc.) you get the idea.

    Used as the criteria for MATCH, when an approximate match is used, it finds the last cell with a number (or numeric value such as time or date) in the specified range.

    If you look at the way the range is defined in the formula, O$1:O3, the first row is absolute, the last row is relative so that the function always looks for a match in the range starting with O1 and ending in the cell directly above the formula, so it effectively always finds the last number above the formula.

    Naturally, if there is no numeric value in that range then the formula will return an error, in which case IFERROR is used to return the last row of the column headers.

+ 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] Positive and Negative Time Values
    By Kpayne in forum Excel General
    Replies: 7
    Last Post: 12-27-2014, 01:26 PM
  2. [SOLVED] Adding Positive and negative time values formatted as text
    By nixxrite in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 11-22-2014, 02:28 PM
  3. [SOLVED] Number difference involving ranges with a mix of positive and negative values
    By coasterman in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-17-2013, 02:34 PM
  4. [SOLVED] Formula to switch a positive value into a negative value
    By trosasco in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-21-2013, 12:10 PM
  5. Replies: 8
    Last Post: 12-13-2012, 01:15 PM
  6. Replies: 6
    Last Post: 05-10-2012, 04:43 AM
  7. Replies: 4
    Last Post: 09-26-2005, 06:05 PM

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