Search code examples
google-sheetsspreadsheetgoogle-docs

Is it possible to sum a value if the substraction of two value on the same row equals something?


I'm trying to build a sheet where I can see how much I have to pay each month.

Let's say I have the following table

Current installment (CI) Total installments (TI) Installment amount (IA)
1 3 $100
1 1 $200
2 3 $150
1 3 $75
2 4 $150
1 1 $50

So, the first month would be if TI-CI >= 1, then I will sum that value. For the following month I would do the same but TI-CI >= 2

And the result would be something like this

- -
1st month debt $475 (the result of 100+150+75+100)
2nd month debt $325 (the result of 100+75+150)
3rd month debt $100

Is this possible at all?


Solution

  • try:

    =IFNA(SUM(FILTER(C$2:C, (B$2:B-A$2:A)>=ROW(A1))))
    

    and drag down

    enter image description here