1) As per the Forum Rules, click EDIT on your original post above and correct the title. It should be appropriate to a Google Search on the same issue.

Perhaps: Count instances by multiple criteria

2) The formula will most likely be a SUMPRODUCT() construct.