=If(text)=1,0) - approximate format required that works

  • Thread starter Thread starter sonar
  • Start date Start date
S

sonar

Hi, I am looking for a format that will give me an answer of 1 whe
text is typed in and a 0 when cell is left blank

Please help
 
Hi, you may try this =IF((ISBLANK(A1)=FALSE),0,1

Whatever you type in a cell the formula will return 1. Otherwise, it returns 0

:)
 
How about

=--ISTEXT(A1)

or

=--(A1<>"")

or, since space characters count as text, if you want to ignore just
space characters, perhaps:

=--(LEN(TRIM(A1))>0)
 
Hi,

Can someone please explain the -- (two minus signs), I've seen this used
elsewhere but can't figure it out. Excel help doesn't seem to cover this.

Thanks Rob
 
Try this in a test worksheet

A1: HiThere
B1: =istext(a1)
c1: =-istext(a1)
d1: =--istext(a1)

Then put a number in A1 and watch the differences.

You'll see True or false in B1. The first minus sign converts the true false to
a number (-1 or 0). The second minus sign changes the sign. (You wanted
+1/0???).
 
Dave,

Thanks for the explanation.

Rob
Dave Peterson said:
Try this in a test worksheet

A1: HiThere
B1: =istext(a1)
c1: =-istext(a1)
d1: =--istext(a1)

Then put a number in A1 and watch the differences.

You'll see True or false in B1. The first minus sign converts the true false to
a number (-1 or 0). The second minus sign changes the sign. (You wanted
+1/0???).
 
Back
Top