Find each shortfall
Subtract current stock from required cost. If stock is equal to or greater than the cost, the shortfall is zero and that row is ready. Blank stock is treated as zero. A blank cost leaves an untouched row out of the summary; a partially filled row asks you to finish it or remove it.
shortfall = max(cost − stock, 0)