title: Cumulative count of working days with conditions (multiple employees) in Google Sheets
body: <p>guys,</p>
  <p>I have the following problem: I have the schedule of four employees and I need to count how many consecutive days they are working.</p>
  <p>The file is in Google Sheets, here is the link, if someone wants to copy the data and try it: <a href="https://docs.google.com/spreadsheets/d/1TUJr9skcXQDtGEV36JVHMGgiLzPlCiEgaPqJ5ZazfFI/edit?usp=sharing" rel="nofollow noreferrer">https://docs.google.com/spreadsheets/d/1TUJr9skcXQDtGEV36JVHMGgiLzPlCiEgaPqJ5ZazfFI/edit?usp=sharing</a></p>
  <p>Here is the snip of the document:</p>
  <p><a href="https://i.stack.imgur.com/dXSv6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dXSv6.png" alt="Snipshot" /></a></p>
  <p>In description, Col A, B and C are containing the date, name of the person and its schedule (&quot;Off&quot; for the days he\she doesn't work). This is the raw data.</p>
  <p>Col D is converting to 0s if the person is Off and 1 if the person is working.</p>
  <p>Col E is the column on which I can make changes, taking people off shift when they are scheduled and vice versa.  (data validation column with 2 values).</p>
  <p>Col F is converting to 0s if the person is Off and 1 if the person is working after my change.</p>
  <p>In Col G I have used formula =IF(F2=0,0,SUMIFS(F$2:F,B$2:B,B2,A$2:A,&quot;&lt;=&quot;&amp;A2)) to count the consecutive days, but unfortunately it counts all days with a casual zeros in between.</p>
  <p>What I need is the numbers to restart after a zero (col H, I have filled it manually).</p>
  <p>This is an example data with four employees, but my original data is with over 300.</p>
  <p>I also am not very proficient in using scripts so I would really prefer to be a formula.</p>
  <p>Any help would be highly appreciated!</p>
  <p>P.S. If someone can suggest a better display of my data and how to achieve it I would be very grateful!</p>