I feel like this is a super basic math problem but I've had a long day and it's stumping me.
Two people are paying for some shared expenses. Some expenses are private. Some expenses are not shared and one person owes the other.
I'm trying to come up with a formula to figure what each person owes the other.
I have these variables:
aPaid= what personapaid for the shared expenseaPrivate= what personapaid but is private to them (for example, a drink from a shared dinner bill)aOwesB= an ad-hoc amount of money that personaowesbbPaid= what personbpaid for the shared expensebPrivate= what personbpaid but is private to thembOwesA= an ad-hoc amount of money that personbowesa
Now I need a formula that says how much money a and b need to exchange to balance the books.
I know how to calculate what the shared amount that needs to be split is:
sharedAmount = (aPaid - aPrivate) + (bPaid - bPrivate)
For example:
| variable | value |
|---|---|
aPaid |
1000 |
aPrivate |
200 |
aOwesB |
100 |
bPaid |
800 |
bPrivate |
100 |
bOwesA |
50 |
Then sharedAmount is 1500 ((1000 - 200) + (800 - 100)).
So each person's share is $750.
But I don't know how to take that and figure out who needs to send how much money to balance the books.