VBA sum up the adjacent dates

Copper Contributor

I'm having trouble to produce a replenishment report.  For each row there's a customer's info and the expiration dates for different items.  But we want to be cost efficient by shipping more than 1 item at a time.  So for example, if there's an item I need to ship in November then I would also ship everything that need to be shipped in November and December and January if there are shipments need to be made in all 3 of those months, but they have to be consecutive months. If there's nothing need to be shipped in December, we will not ship January's supply. And of course, if there's nothing need to be shipped in January, we only ship out November and December's supply.  

The thing is all those supplies shipped count as November's shipments or they count as November's sales.  I'm suppose to create a summary table showing  the amount of shipments  for each month for each Territory.

 

Anyone have an idea how to do the count? I'm thinking about start with January and brute force it with VBA, but are there any smarter ways of doing this?

0 Replies