To count or sum logical results, convert TRUE/FALSE to 1/0. The double-negative (--) is the pro’s way; multiplying or adding zero works too.
-- coerces each TRUE/FALSE to 1/0; SUMPRODUCT sums them — the count of values over 100.
The example
Counting the TRUEs across a range.
| A | B | |
|---|---|---|
| 1 | Test | As number |
| 2 | TRUE | 1 |
| 3 | FALSE | 0 |
The formula
Coerce, then sum:
How it works
A math operation flips boolean to numeric:
- A logical test gives TRUE/FALSE; arithmetic forces it to 1/0.
- The double unary
--is the cleanest:--(A2>100)is 1 or 0. (A2>100)*1and(A2>100)+0do the same.- Inside SUMPRODUCT or SUM, this counts or weights rows meeting a condition — the engine behind many array formulas.
Multiply conditions for AND, add for OR. --((a)*(b)) counts rows meeting both; this 1/0 coercion is what makes SUMPRODUCT a flexible conditional counter when COUNTIFS can’t express the logic.
Try it: interactive demo
Values; count those over the threshold.
Variations
Multiply version
Same as --:
Weighted sum
Condition times values:
Single cell
1 or 0:
Pitfalls & errors
Booleans don’t auto-sum. Some functions ignore TRUE/FALSE — coerce to 1/0 with -- first.
Two minus signs. A single - negates (TRUE→−1); use two to get a positive 1.
Text won’t coerce cleanly. The trick works on logical results, not arbitrary text.
Practice workbook
Frequently asked questions
How do I convert TRUE/FALSE to 1/0 in Excel?
How do I count values meeting a condition with SUMPRODUCT?
Why two minus signs?
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