• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Adding up booleans.

Grigoriy

New Member
Hello, everyone!
TRUE + TRUE + FALSE must equal to 1, according to Boolean logic.
Excel will give 2 (1+1+0).
Any idea, how to make excel sum "Booleans"?
 
Use If function :

=IF(logical_test,1,0)

=IF(TRUE+TRUE+FALSE,1,0)

=1
Thanks for the help.
But not that easy: imagine an array to process (i.e. with SUMPRODUCT function) with multiple TRUES and FALSES.
Only 1 and 0s are acceptable, 2s, 3s etc. aren't.
 
Thanks for the help.
But not that easy: imagine an array to process (i.e. with SUMPRODUCT function) with multiple TRUES and FALSES.
Only 1 and 0s are acceptable, 2s, 3s etc. aren't.

Please give more information and show example of your array.
 
Since you are dealing with Booleans, I would name the array 'Booleans' (I'm creative like that!)

If you use logic operations, the formula would be
= OR(Booleans)
= OR(X, Y, Z)

There are a number of ways of converting the TRUE to 1, including
= SIGN(OR(Booleans))
= SIGN( OR(X, Y, Z) )

If you prefer to stick with arithmetic operators, you could turn to de'Morgan's laws to reformulate the formula
= 1 - PRODUCT(1 - Booleans)
= 1 - (1-X)*(1-Y)*(1-Z)

[equivalent to
= NOT(AND(NOT(Booleans)))
= NOT( AND(NOT(X), NOT(Y), NOT(Z)) )
]
 
Last edited:
Yes!
=0+((C$25=$M$4)+(C$25=$N$4)+($B53=$L$4)>0)
perfecting it to the following: =((C$25=$M$4)+(C$25=$N$4)+($B53=$L$4)>0)
Both are genius!
Thanks a lot.
Kind regards,
Grigoriy from Moscow.
 
Back
Top