Hidden rows are not excluded in SUM/COUNT/AVERAGE/MAX/MIN functions; what does this mean? Your results may appear greater, distorted, etc.
How to avoid this situation? Use SUBTOTAL function…
Follow the below steps :
 1. Write SUBTOTAL function 
2. Specify “function_num” as 109. 101 to 111 options ignore values of rows hidden by the Hide Rows Command. 
3. Complete the Formula: =SUBTOTAL(109,B2:B7) 
4. Enter
If B3 & B4 are hidden rows, Then they would not be included in calculation.
.