Could someone please advise on how to tackle the following problem:

**Cell A1**contains a variable number, let's say "4"

**Row B:**cellscontain periods (say 100 periods)

**Row C:**cells contains either "1" or "0"

**Row D:**Here I want to add a formula that returns "1" if the number for the corresponding period in row C is 1, but (this is the difficulty) only if the 4 preceding periods in Row C also have a value of 1. The number of preceding periods should be variable (and will be manually adjustable in cell A1).

I hope this is clear, if not please let me know. Can anyone help me?

Thanks!

Eduard