In cell F77 of my spreadsheet I would like the count/sum the number of "P" and "EX" in cells F4:F66 that correspond to any "H", "M", "L" entries in cells AY3:AY66. All cells in F4:F66 either have a "P", "I", "EX", or "C" or they are blank. All cells in AY3:AY66 either have a "H", "M", "L" or they are blank. I created the following function and it works, but I would like the ability to sort or filter by either column and have the sum/count reflect the sort/filter.

=SUM(COUNTIFS($AY4:$AY66,"*",F4:F66,{"P","EX"}))

I think I have to use SUMPRODUCT.

Any help would be greatly appreciated.

-B