A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
In that case, try this
=MAX(0,MIN($A5,D$2)-MAX(C5,$A5)+1)
This formula calculates the number of days an item is on sale within each week it is on sale. It checks if the start date (C5) is less than or equal to the week ending date ($A5) and if the end date (D$2) is greater than or equal to the start date of the promotion ($A5). If both conditions are true, it calculates the minimum of the week ending date and the end date minus the maximum of the start date and the start date of the promotion, and adds 1 to include both the start and end dates. If either condition is false, it returns 0.
You can enter this formula into cell B5 and then drag it down to fill in the remaining cells in column B. This should give you the expected results: B5=7, B6=3, B7=7, B8=4, etc.
I hope this helps!
Regards Adeyemi