The following Excel formula calculates how many days overlap in two intervals.
$B$1 - end of the first interval
$A$1 - start of the second interval
$B$2 - end of the first interval
$A$2 - end of the second interval
=MAX(MIN($B$1, B2) - MAX($A$1, A2) + 1, 0)