Hello
I’m Adeyemi and I’d be happy to help you with your question.
You can use the following formula to calculate the number of days an item is on sale within each week it is on sale:
=IF(AND(C5<=$B$2,D5>=$B$3),MIN(D5,$A5)-MAX(C5,$A5)+1,0)
This formula checks if the start date (C5) is less than or equal to the end date of the promotion ($B$2) and if the end date (D5) is greater than or equal to the start date of the promotion ($B$3). If both conditions are true, it calculates the minimum of the end date and the week ending date ($A5) minus the maximum of the start date and the start date of the promotion ($A5), and adds 1 to include both the start and end dates. If either condition is false, it returns 0.
You can then drag this formula down to fill in the remaining cells in column B. This should give you the expected results: B5=7, B6=3, B7=11, B8=4, etc.
I hope this helps!
Give back to the Community. Help the next person who has this issue by indicating if this reply solved your problem. Click Yes or No below
Regards Adeyemi