Support Board
Date/Time: Thu, 06 Feb 2025 02:52:40 +0000
[Programming Help] - Spreadsheet / Series of positive numbers sum
View Count: 678
[2020-04-07 04:32:09] |
User827002 - Posts: 37 |
I'm trying to find the sum of each series of real numbers in column O (see attached file). If I were to do this in column P, P5 would show "4" (1.5 + 1.75 + 0.75). P9 would show "1", P12 would show 3.5, and so forth. How can I go about achieving this?
|
Sierra.spreadsheet.PNG / V - Attached On 2020-04-07 04:31:02 UTC - Size: 26.16 KB - 226 views |
[2020-04-07 15:37:25] |
Sawtooth - Posts: 4169 |
Try this in P3: =IF(AND(O4=0,O3>0),O3,IF(AND(O4>0,O3>0),O3+P4,P4)) This will increment the sum in a series, then be persistent until the next series. Here are more examples of persistent and incrementing variables: Spreadsheet Example Formulas and Usage: Persistent and Incrementing Variables |
[2020-04-08 04:12:07] |
User827002 - Posts: 37 |
Thanks for the reply. I tried that formula, it did add the sum of each series of numbers (which I outlined in column P in the attached file), but the sums continue repeating themselves in the column. Do you know how I can fix this and only show the sum once and show 0 for every row until a new sum is established?
|
Inkedsierra.spreadsheet2_LI.jpg / V - Attached On 2020-04-08 04:06:45 UTC - Size: 558.54 KB - 281 views |
[2020-04-08 12:31:36] |
Sawtooth - Posts: 4169 |
Try this in P3: =IF(O3=0,0,IF(O3>0,O3+P4,P4)) This will increment the sum in a series, then return 0 when the series ends. If you only want the final sum, and not the intermediate ones, you'll need to use another separate Formula Column, e.g. R3: =IF(AND(P3>0,P2=0),P3,0) Note that the final sum can't be known until P3 is zero. |
To post a message in this thread, you need to log in with your Sierra Chart account: