Sort you data according your category to do so select A2:F101 then press Alt->A->S->S select short by category then ok.

now in H2
Formula: copy to clipboard
=LOOKUP(2,1/($G2=$A$2:$A$101),$F$2:$F$101)


Copy down.!