R: for each row in DF1 subset/count corresponding rows in DF2
Here is a solution using data.table package.

DF3 &lt;- data.table(merge(DF1, DF2, by = "CATEGORY")) # merge tables by category
DF3$TIME_OK &lt;- (DF3$TIME &gt;= DF3$START &amp; DF3$TIME &lt;= DF3$END) # create a column to check time
DF3 &lt;- DF3[DF3$TIME_OK == T,] # subset table
DF3 &lt;- DF3[,.(NO_OF_OBJECT = .N), by = c("CATEGORY", "DATE", "TIME")] # aggregate results


Basically, it merges both data frames and subsets only relevant time period before aggregating results.