ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Evaluate boolean values as 1 or 0 (https://www.excelbanter.com/excel-worksheet-functions/200977-evaluate-boolean-values-1-0-a.html)

hmm

Evaluate boolean values as 1 or 0
 
How do I use boolean values so that a formula would evaluate TRUE as 1 and
FALSE as 0? For example, if column A contains boolean values, I want to
avoid formulas like {SUM(IF(A1:A100, 1, 0))}. Instead, I would like to just
enter {SUM(A1:A100)}. Presently, in such a formula both TRUE and FALSE are
treated as 0.

Per Jessen

Evaluate boolean values as 1 or 0
 
Hi

=COUNTIF(A1:A100,TRUE)

Regards,
Per

"hmm" skrev i meddelelsen
...
How do I use boolean values so that a formula would evaluate TRUE as 1 and
FALSE as 0? For example, if column A contains boolean values, I want to
avoid formulas like {SUM(IF(A1:A100, 1, 0))}. Instead, I would like to
just
enter {SUM(A1:A100)}. Presently, in such a formula both TRUE and FALSE
are
treated as 0.



Stefi

Evaluate boolean values as 1 or 0
 
Try this:
{SUM(--(A1:A100))}

Regards,
Stefi

€˛hmm€¯ ezt Ć*rta:

How do I use boolean values so that a formula would evaluate TRUE as 1 and
FALSE as 0? For example, if column A contains boolean values, I want to
avoid formulas like {SUM(IF(A1:A100, 1, 0))}. Instead, I would like to just
enter {SUM(A1:A100)}. Presently, in such a formula both TRUE and FALSE are
treated as 0.


Duke Carey

Evaluate boolean values as 1 or 0
 
In addition to the other replies, you can:

force the formulas that evaluate to to TRUE or FALSE to evaluate to 1 or 0
by multiplying the result by 1, or use

=SUMPRODUCT(a1:a100*1)

"hmm" wrote:

How do I use boolean values so that a formula would evaluate TRUE as 1 and
FALSE as 0? For example, if column A contains boolean values, I want to
avoid formulas like {SUM(IF(A1:A100, 1, 0))}. Instead, I would like to just
enter {SUM(A1:A100)}. Presently, in such a formula both TRUE and FALSE are
treated as 0.



All times are GMT +1. The time now is 03:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com