For Sumif function need range & Criteria. Range means which column that contains finding data. Means for make department wise summery we need select department column D.
Each Department is our criteria. Range (D:D) Criteria (F5) or Text
In the cell G5 press =COUNTIF( Then select Range coloumn D & press comma
then click criteria cell F5 (Text can use as criteria in the inverted comma Ex. “HR”)& Press comma Close the bracket & Press Enter.
=COUNTIF(D:D,F5) or =COUNTIF(D:D,”HR”) Copy that formula cell & paste in the cell bellow.