Does True Have a Numerical Value

G

Guest

OK I know that I could convert "true" to a numerical value with my own
formula but let's say I'm using the COUNTIF() function and it comes back
TRUE. Does TRUE have a numerical value?

I know that when I use the DELTA() funciton and two things equal it returns
a "1"

I'm not making a spreadsheet now that actually applies this. Just working
on something in my head for further knowledge.

What I'm hoping is that TRUE=1 and 0=FALSE. But I'm probably not so lucky.
They're probably NOT interchangable for a reason and I'd just like to know
why.

(e-mail address removed)
 
P

Peo Sjoblom

If you calculate with TRUE or FALSE they return 1 and 0
That is the whole idea behind array formulas, however the only way
countif can return TRUE is if you use a condition like

=COUNTIF(A2:A10,"x")>0

and if you for instance have 10 TRUE in C1:C10

=SUM(C1:C10)

will return 0 however if you add -- into the mixture like in

=SUM(--C1:C10)

and enter it with ctrl + shift & enter it will return 10



--
Regards,

Peo Sjoblom

(No private emails please)
 
R

Roger Govier

Hi Jacob

In addition to the advice given by Peo, you can convert your original True's
to 1's and False's to 0's by using the double unary operator --.

= --TRUE will return a 1
=--(COUNTIF(A2:A10,"x")>0) will also return a 1 rather than TRUE,
hence you can sum the True's (1's) without having to resort to an array
formula.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top