# Need help with cumulative results

Hi there !

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

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

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 )

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 )

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

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

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 .
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

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

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

Hi!

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

@Pch

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

1 Like

Oh ! Goodness Gracious !!!

@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

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

Thank you all for the this wonderful boost

2 Likes

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

1 Like