The challenge is the COUNTIFS function applies AND logic by default.
By default, the COUNTIFS function applies AND logic.
Note: this technique will only handle two range/criteria pairs.
If you have more than two criteria,consider a SUMPRODUCT formula as described here.
This formula “just works” in the current version of Excel, which supportsdynamic array formulas.
However, inLegacy Excel, the formula must be entered with Control + Shift + Enter.