This may work for you. I created a table out of your data and then sorted by the Product to group like products together. I then added two columns to the table (columns D and E). I also entered the start date of the period in M2 and the end date in M3.
Formula for column D entered in D2 (this will auto fill column D with the formula) This calculates the difference between order dates where there wouldn't be any inventory.
Enter this formula in E2 (column will auto fill). This will calculate days that inventory is absent before the first order
The desired values are in column J.
Enter this formula in J2 and fill down
I have no time to test this against all scenarios so I may not have covered everything.
If nothing else, it should give you some ideas on how to proceed.
Bookmarks