Use Evaluate or Application.CountIfs(), or just use Range.Formula
That'll be the easiest method.
Otherwise, you'll need some sort of container and logic to hold Company & Title, and the count. Typically done using dictionary object.
As well, you should use absolute reference for the range in your formula.
=COUNTIFS($B$2:$B$18,B2,$A$2:$A$18,A2)