VBA UDF to calculate stock reserves duration in days?

I get your point. But I need the exact number of days of consumption to deplete my stock level on that day if I had no more stock coming from the day after onwards. It has to be accurate at least to .5, and using average gets me deviation of 4 days vs actual result (row where you see 29.2 etc)

Consumption is already given for each day. I don't think it's impossible to do without average, because the row where you see 29.2, that's the actual result I need to get with my formula. A system calculated it so it's possible to do, I just need to emulate the formula used in that system.

If I have 10 boxes today, and I already know that I will use 5 tomorrow, then 3, and then 2, my stock is 3 days.

You can also see it as a payback period formula.

/r/vba Thread Parent