# Sum of rows until a condition changes

I have a Google Sheet with the following format:

``````A           B       C       D
10-12-18    17.36   Start
10-12-18    17.49   Stop    13
10-12-18    17.49   Start
10-12-18    17.51   Stop    2
10-15-18    09.19   Start
10-15-18    09.32   Stop    13
``````

Column A is a date, column B a time, column C Start/Stop status and column D the duration of the two timestamps Start/Stop for each day.

Now I want to calculate the sum of all column D duration for each day.

This is how it should look like in the end (column E sums up all of the durations per day):

``````A           B       C       D       E
10-12-18    17.36   Start
10-12-18    17.49   Stop    13
10-12-18    17.49   Start
10-12-18    17.51   Stop    2       15
10-15-18    09.19   Start
10-15-18    09.32   Stop    13      13
``````

How can I achieve that? SUMIF? ARRAYFORMULA?

`=IF(A2="";"";IF(A3="";SUM(D\$1:D2)-SUM(E\$1:E1);IF(IF(ISNUMBER(A2);A2;DATE(VALUE("20"&RIGHT(TO_TEXT(A2);2));LEFT(TO_TEXT(A2);2);MID(TO_TEXT(A2);FIND("-";TO_TEXT(SUBSTITUTE(A2;".";"-")))+1;2)))<IF(ISNUMBER(A3);A3;DATE(VALUE("20"&RIGHT(TO_TEXT(A3);2));LEFT(TO_TEXT(A3);2);MID(TO_TEXT(A3);FIND("-";TO_TEXT(SUBSTITUTE(A3;".";"-")))+1;2)));SUM(D\$1:D2)-SUM(E\$1:E1);"")))`