Answer the question
In order to leave comments, you need to log in
Can the algorithm be expressed as a mathematical formula?
Tell me please, I'm dumbing down something wildly. How to express the following logic with a mathematical formula (like sequences x1 ... xn, well, or something else):
1) First case
X1 - Cell A = 500
X2 - Cell B = 500
X3 - Cell C = 500
Z - Payment = 700
In descending order c > b > a, the payment will be distributed and the new amounts will look like this:
Y1 - Cell A = 500
Y2 - Cell B = 300
Y3 - Cell C = 0
2) Second case
X1 - Cell A = 500
X2 - Cell B = 500
X3 - Cell C = 500
Z - Payment = 300
Descending c > b > a the payment will be distributed and the new amounts will look like this:
Y1 - Cell A = 500
Y2 - Cell B = 500
Y3 - Cell C = 200
3) Third case, when the payment is equal to the amount in cell C.
Ie I want to get something like this: y2 = x2 - (z - x3 - ...), y3 = ..., y1 = ...
Is this even possible?) Maybe the systems should help here?
Or without conditions like: if (z > x3) ? 0 : x3 - z
can't do it?
I think the whole problem lies in the impossibility of using negative values ...
Answer the question
In order to leave comments, you need to log in
Use the max.
The value in each cell will be
max(0, (тукущее значение) - max(0, (платеж) - (сумма всех следующих ячеек)))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question