Count rows that match condition A or B without double-counting the ones that match both. SUMPRODUCT with SIGN caps each row at one.
The example
Rows that are Open or High (or both) counted once each.
| A | B | |
|---|---|---|
| 1 | Status | Priority |
| 2 | Open | High |
| 3 | Done | High |
| 4 | Open | Low |
| 5 | Open OR High | 3 |
The formula
Add conditions, cap with SIGN:
How it works
SIGN prevents double-counting:
- Each condition is a 1/0 array; adding them gives 0, 1, or 2 per row.
- A row matching both conditions would be 2 —
SIGNturns any positive into 1. SUMPRODUCTsums the capped values — the count of rows matching at least one condition.- Simpler when conditions are on the same column:
=COUNTIF(rng,"A")+COUNTIF(rng,"B")(no overlap possible there).
Inclusion-exclusion alternative: =COUNTIF(A,"Open") + COUNTIF(B,"High") − COUNTIFS(A,"Open",B,"High") — add the two counts, subtract the overlap. The SIGN version is tidier for many conditions.
Try it: interactive demo
Lines “status,priority”; count Open OR High.
Variations
Inclusion-exclusion
Add minus overlap:
Same column OR
No overlap:
Three conditions
Add another array inside SIGN.
Pitfalls & errors
SIGN stops double-counting. Without it, a row matching both conditions adds 2. Always cap multi-column ORs.
Equal-length arrays. Every condition array must span the same rows.
Same-column OR is simpler. Two values in one column can’t both match, so plain addition is safe there.
Practice workbook
Frequently asked questions
How do I count rows meeting any of several conditions in Excel?
Why use SIGN?
What's the inclusion-exclusion version?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class