Okay, I'm just going to explain how to do one instead of doing the entire sheet for you, since I'm not sure on what you were asking for anyway...
=COUNTIF(INDIRECT("Sheet2!D"&MATCH($B5,Sheet2!$C$3:$C$15,0)+2&":K"&MATCH($B5,Sheet2!$C$3:$C$15,0)+2),"*"&"GATE"&"*")
In cell C5 on sheet 3, then double click it down.
Now to explain this function...
I am utilizing indirect to give the range that is described in text within. We are utilizing the match function to find the position of the match in the given range, then applying a correction number so it spits out the row value. Utilizing that trick, you can have it look at all of the correct ranges in your other page, regardless of how you organize the names, etc.
So for example, in the day two column, it would change to this:
=COUNTIF(INDIRECT("Sheet2!D"&MATCH($B5,Sheet2!$C$17:$C$29,0)+16&":K"&MATCH($B5,Sheet2!$C$17:$C$29,0)+16),"*"&"GATE"&"*")
I locked the B column by entering it as $B5, so you can simply drag the formula to the right and adjust it as necessary. If you have a lot of different days, you could make it so every-time you drag it right it auto-does the corrections for you (making it a super complicated formula), but your sample data doesn't suggest this is necessary.
It would probably be smarter to re-format how your data is than attempting to create a massive formula if manually redo-ing this is too much for you. For example, creating named ranges for each day, then utilizing indirect and the columns function to return everything in that named range. If you called them Day 1, etc.
=indirect("Day "&columns($A:A))
Would refer to the given range (and drag right, changing to Day 1, Day 2, etc. instead of having all of the correction factors etc. It would just be a matter of setting up all the named ranges then you could refer back to them easily.
Hope this helps.
Bookmarks