Problem:

Columns B & C show the times that each of a building\'s tenants left and returned on a particular day.
We want to calculate the building\'s occupancy rate at each of the times listed in column E.

Solution:

Use the COUNTIF and COUNT functions as shown in the following formula:
=(COUNTIF($C$2:$C$6,\">=\"&E2)-COUNTIF($B$2:$B$6,\">\"&E2))/
COUNT($A$2:$A$6)