Countifs could work, so can sumproduct, it would be helpful to post a sample workbook with enough examples to show what you are dealing with AND expected results. Go Advanced then manage attachments to upload a workbook.