IF Statement not working

christinamfisher

New Member
Joined
Jun 18, 2018
Messages
6
Hi! I am trying to convert 'TRUE/FALSE' values into binaries (0 and 1). I am using the IF statement =IF(B2="FALSE",0,1). The list is returning either all zeros or all ones. Ideas on how to fix this? I have tried converting to text and to general. I believe the syntax is correct as I have used it previously like this : =IF(E2="Under",1,0) in another workbook. I have also tried to copy and paste into another workbook. Any help would be GREATLY appreciated.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hi,

A few things I'd like to point out, the below applies to Both TRUE/FALSE:

1. In your IF formula, you're checking B1 for the Text Word "FALSE", Not the Excel logical FALSE, they are Not the same.
2. If Tetra's suggestion did Not work for you, then what you have in B1 is Not the Excel logical FALSE.
3. What Exactly do you have in B1? How did it get there? If by formula, what's the formula?

See below samples:


Book1
ABCDE
1FALSEFALSETRUE0
2FALSETRUEFALSE#VALUE!
Sheet89
Cell Formulas
RangeFormula
C1=A1="FALSE"
C2=A2="FALSE"
D1=A1=FALSE
D2=A2=FALSE
E1=--A1
E2=--A2
A2="FALSE"


A1 is Excel logical FALSE
A2 is the Text Word "FALSE"
 
Upvote 0
If your data is downloaded, often times they contain "hidden" characters and/or leading and/or trailing spaces.

What does =LEN(B1) give you?
 
Upvote 0
Worth a shot, try this:

=IF(CLEAN(B2)="FALSE",0,1)

or, even:

=IF(TRIM(CLEAN(B2))="FALSE",0,1)
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top