I think you need to use the IF command and the < (less than) operator.
amount to roder =IF(ending inventory < what I need), what I need - ending inventory, 0)
The above says if ending inventory is less than what you need, then return what you need minus ending inventory, otherwise return zero.
To round up you would use something like
RoundUp(amount to order, 0)
The 0 means do not include any decimal places in the result.
Something like this should do.