Boolean logic (after George Boole) reduces all values to TRUE or FALSE. Often it is easier to calculate a condition directly instead of using IF.
The condition =$B$4=H3 returns TRUE or FALSE. A double minus converts it into 1 or 0:
=--($B$4=H3)
SUMPRODUCT
Multiplies corresponding components of arrays and adds up the products. Combined with Boolean logic it is a universal “sum by condition”:
=SUMPRODUCT(--($A$2:$A$11=F2),$C$2:$C$11)
For each row: 1 × salary if the branch matches, 0 × salary otherwise. The sum is the branch payroll. Several conditions are simply multiplied:
=SUMPRODUCT(($A$2:$A$11=F2)*($B$2:$B$11="Manager")*$C$2:$C$11)