Hi Kaper, that would generate same results as my suggestion albeit yours caters for possibility of there being no "break" which mine did not -- oops.

Adapted the below per above - I think this would be a little more efficient but tbh given they're both volatile (c/o TODAY) there's unlikely to be any notable difference {given sample size}.

Formula: copy to clipboard
C2: =IF(INDEX($D2:$IV2,$A$24)="",0,TODAY()-IFERROR(LOOKUP(2,1/($D2:INDEX($D2:$IV2,$A$24-1)=""),$D$1:INDEX($D$1:$IV$1,$A$24-1)),$D$1-1))

A24: =MATCH(TODAY(),$D$1:$IV$1,0)


On an aside I think the results for the non-gaps should read 21 rather than 20? i.e. $D$1-1