Hello. I have a worksheet with some columns of values. I have columns with hours, price and amount (as seen in picture). I have to optimize the amount by ordering it in hours with largest price. That is not a problem, with LARGE, MATCH and INDEX functions it worked well (see Optimized amount). But now I have a column with level restrictions (see Level). And therefore I have to move value of optimized amount to match the level as soon as it reaches 72. If the level is less than 72 nothing should be moved. How could I do that?