Hi,
See if this helps:
| A | B | C | D | E | F | G |
---|
User ID | Amount | Date | Amount due | Date | Due from | Due Amount | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
<tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]565[/TD]
[TD="align: right"]8/22/2017[/TD]
[TD="align: right"]565[/TD]
[TD="align: right"]8/22/2017[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]-55[/TD]
[TD="align: right"]8/22/2018[/TD]
[TD="align: right"]510[/TD]
[TD="align: right"]8/22/2017[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]-45[/TD]
[TD="align: right"]11/12/2018[/TD]
[TD="align: right"]465[/TD]
[TD="align: right"]8/22/2017[/TD]
[TD="align: right"]8/22/2017[/TD]
[TD="align: right"]465[/TD]
[TD="align: center"]5[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]200[/TD]
[TD="align: right"]12/31/2018[/TD]
[TD="align: right"]200[/TD]
[TD="align: right"]12/31/2018[/TD]
[TD="align: center"]6[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]-10[/TD]
[TD="align: right"]6/21/2019[/TD]
[TD="align: right"]190[/TD]
[TD="align: right"]12/31/2018[/TD]
[TD="align: right"]12/31/2018[/TD]
[TD="align: right"]190[/TD]
</tbody>
Sheet1
[TABLE="width: 85%"]
<tbody>[TR]
[TD]
Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH]D2[/TH]
[TD="align: left"]=IF(
A2=A1,IF(B2<0,B2+D1,B2),B2)[/TD]
[/TR]
[TR]
[TH]E2[/TH]
[TD="align: left"]=IF(
B2>=0,C2,E1)[/TD]
[/TR]
[TR]
[TH]F2[/TH]
[TD="align: left"]=IF(
E2=E3,"",E2)[/TD]
[/TR]
[TR]
[TH]G2[/TH]
[TD="align: left"]=IF(
F2="","",D2)[/TD]
[/TR]
[TR]
[TH]D3[/TH]
[TD="align: left"]=IF(
A3=A2,IF(B3<0,B3+D2,B3),B3)[/TD]
[/TR]
[TR]
[TH]E3[/TH]
[TD="align: left"]=IF(
B3>=0,C3,E2)[/TD]
[/TR]
[TR]
[TH]F3[/TH]
[TD="align: left"]=IF(
E3=E4,"",E3)[/TD]
[/TR]
[TR]
[TH]G3[/TH]
[TD="align: left"]=IF(
F3="","",D3)[/TD]
[/TR]
[TR]
[TH]D4[/TH]
[TD="align: left"]=IF(
A4=A3,IF(B4<0,B4+D3,B4),B4)[/TD]
[/TR]
[TR]
[TH]E4[/TH]
[TD="align: left"]=IF(
B4>=0,C4,E3)[/TD]
[/TR]
[TR]
[TH]F4[/TH]
[TD="align: left"]=IF(
E4=E5,"",E4)[/TD]
[/TR]
[TR]
[TH]G4[/TH]
[TD="align: left"]=IF(
F4="","",D4)[/TD]
[/TR]
[TR]
[TH]D5[/TH]
[TD="align: left"]=IF(
A5=A4,IF(B5<0,B5+D4,B5),B5)[/TD]
[/TR]
[TR]
[TH]E5[/TH]
[TD="align: left"]=IF(
B5>=0,C5,E4)[/TD]
[/TR]
[TR]
[TH]F5[/TH]
[TD="align: left"]=IF(
E5=E6,"",E5)[/TD]
[/TR]
[TR]
[TH]G5[/TH]
[TD="align: left"]=IF(
F5="","",D5)[/TD]
[/TR]
[TR]
[TH]C6[/TH]
[TD="align: left"]=TODAY()[/TD]
[/TR]
[TR]
[TH]D6[/TH]
[TD="align: left"]=IF(
A6=A5,IF(B6<0,B6+D5,B6),B6)[/TD]
[/TR]
[TR]
[TH]E6[/TH]
[TD="align: left"]=IF(
B6>=0,C6,E5)[/TD]
[/TR]
[TR]
[TH]F6[/TH]
[TD="align: left"]=IF(
E6=E7,"",E6)[/TD]
[/TR]
[TR]
[TH]G6[/TH]
[TD="align: left"]=IF(
F6="","",D6)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
This is great, however, a few follow up questions I have in regards to this. What's found in B6 shouldn't go against the more recent debt, it should go against the oldest debt if one is still present. Therefore, G4 should be 455 due since 2017-08-22, and G6 should see 200 due since 2018-12-31.
Additionally, I've tried continuing the code with another USER ID and it doesn't seem to flow through, is there something specific I must do... as in cannot simply drag the code down? I will keep looking at it, and see if I can figure out how on my own too. Thank you very much for the help!
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][TABLE="width: 54"]
<colgroup><col></colgroup><tbody>[TR]
[TD]USER ID[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD][TABLE="width: 57"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Amount[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Date [/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD][TABLE="width: 84"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Amount due[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Date[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Due From[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 83"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Due amount[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[/TR]
[TR]
[TD]<strike></strike>123
[/TD]
[TD]565
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2017-08-22[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD][TABLE="width: 84"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]565[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2017-08-22[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]-55
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2018-08-22[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>510
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2017-08-22[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]-45
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2018-11-12[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>465
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2017-08-22[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2017-08-22[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]465
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]200
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2018-12-31[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>200
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2018-12-31[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]-10
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2019-06-21[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>190
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2018-12-31[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2018-12-31[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]190
[/TD]
[/TR]
[TR]
[TD]234
[/TD]
[TD]560
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2016-08-22[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>560
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2016-08-22[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2016-08-22[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]560
[/TD]
[/TR]
[TR]
[TD]234
[/TD]
[TD]234
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2019-08-22[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>234
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2017-08-22[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]234
[/TD]
[TD]-4
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2018-11-12[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>189
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2017-08-22[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]234
[/TD]
[TD]-78
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2018-12-31[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>111
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2017-08-22[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]234
[/TD]
[TD]-45
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2019-06-21[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>66
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2017-08-22[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD][TABLE="width: 73"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]2017-08-22[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 83"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>66
[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>