, and the difference between them is the total owed by the individuals to the group (and vice-versa). We put that in the ”Money Owed” column.
To go from that vague state of general “owing/owed”, we need to calculate specific suggested payment one-by-one. To track our progress we keep a “Remaining Owed” column on
that is not defined by a formula, it’s only updated as we generate payments. The “Reset Money Owed” button sets its initial values to simply be the “Money Owed” column from the above calculation:
FormulaMap(
[Money Owed],
ModifyRows(
CurrentValue,
[Remaining Owed], Owed
)
)
The “Generate next payment” button is what creates a suggested payment. Each payment suggestion is made by having the most-in-debt person pay the person who is owed the most:
RunActions(
AddRow(
[Suggested Settleups],
[Suggested Settleups].From, [Most in debt].[Who?],
updated to reflect the payment that was just suggested.
This logic heavily relies on the separate formulas that calculate the participants “Most in debt” and “Most owed”, and the “Next Payment Amount” that prevents an overpayment (in cases when the in-debt participant owes more to the group than the group owes the most-owed participant).