Use COUNTIFS

Hence,
=COUNTIFS(A:A,"#N/A",E:E,G2)
where G2 equals 'IN'

Adapt for the others