Need help with cumulative results

Hi there :wave: :blush: !

I’m very new to Coda and have been having a lot of fun with it for the past few weeks now :blush:
(I really really like it :grin: !)

But I’m currently completely stuck with one of my tables where I’m trying to get a cumulative result :confused:

This is a screenshot of a “Test” table I’ve created

What I’m trying to get in the [Results] column is a cumulative Sum() of the column N2 but only with the numbers in N2 between the Row where N1=0 (which is the row Test1 here) and N3=0 (the row Test4) and then the Sum() continues with the next Row where N1=0 (Test5)

Is it possible ?
(I don’t mind complex solutions as I love to learn :grin:)

In my now-messy-non-test-table, those 2 specific values : N1= 0 and N3= 0 are landmarks I can count on along with the date & time in column 7 (which I forgot to rename before taking the screenshot :yum: )

I’ve searched a lot here for a solution but wasn’t able to find one or, possibly, to apply it to my table :sweat:

If someone has a solution, I’m all ears :wink: !

Before attempting a solution, can you confirm what the Results column should calculate to in the above-example?

Well, I’m trying to get this kind of results :

But, the Results in the row "Test5" should go back to Sum() from N2=1 giving me the same results as the 4 first rows do :slight_smile: .
That’s why I see N1=0 and N3=0 as landmarks. They really are constants in my “non-test-table” creating kind of cycle.

To get there, in the screenshot above, I used RowID and this formula which partially do the work (at least for the 4 first rows) but I’m stuck there :sweat:

I’ve tried many different combinations of Filter() and Lookup(), tried to use Min() and Max(), First(),Last()… but I don’t seem to be able to find the right way to get it to work :confused:

I hope this is a little bit clearer :grimacing: (It’s not easy to explain :wink: ) but thank you for looking into this :grin:


If I understood this correctly, you want to restart counting whenever N1 is equal to 0?
If that’s the case, you should look into reference the cell above.
The formula should look something like this:

if(N1=0, N2, PreviousRow.Results+N2)

Hope that helps.
If not, would you mind sharing the doc? This way I could better understand what you are trying to achieve.

1 Like

Can respond more later but I think this thread may help: Referencing the cell above

1 Like


Here’s a sample doc illustrating some concepts that might help in your use case:

1 Like

Oh :tada: ! Goodness Gracious :grin: !!!

@Filmos and @shishir , I effectively didn’t see this post about Referencing the cell above (I read part of it, but I’ve got so many post to explore here, that it eluded me).
It’s effectively something that could help and I’ll look into it :grin:

@Ander, I think, you’ve nailed “my approach” of the problem :grin: !
Talking about “cycles” earlier, I was slowly getting (in my “non-test-table”) where your “Example Table” is :grin: (implementing cycles in mine). I’m gonna take a great look into this because I think, this is what I was looking for :grin:

Thank you all for the this wonderful boost :grin: :+1:


@Ander : Thank you very very much :+1: :grin: , this just works perfectly :grin: :tada: ! (Test-table or not :grin:)

1 Like